Delete more code, and hook up gfx_unittests.
While deleting code, I saw that gfx_unittests wasn't hooked
up. Added it to the build rules and the mojob.py list.
BUG=443439
R=sky@chromium.org
Review URL: https://codereview.chromium.org/853033002
diff --git a/BUILD.gn b/BUILD.gn
index f5bfe76..0982382 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -12,6 +12,7 @@
"//services",
"//shell",
"//sky",
+ "//ui/gfx:gfx_unittests",
]
if (!is_android && !is_win) {
diff --git a/mojo/tools/data/unittests b/mojo/tools/data/unittests
index b955b77..225a606 100644
--- a/mojo/tools/data/unittests
+++ b/mojo/tools/data/unittests
@@ -48,6 +48,11 @@
"test": "window_manager_unittests",
},
+ # Tests for components we depend on:
+ {
+ "test": "gfx_unittests",
+ },
+
# JavaScript tests:
{
"test": "js_unittests",
diff --git a/ui/android/java/src/org/chromium/ui/base/TouchDevice.java b/ui/android/java/src/org/chromium/ui/base/TouchDevice.java
deleted file mode 100644
index 6801655..0000000
--- a/ui/android/java/src/org/chromium/ui/base/TouchDevice.java
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.ui.base;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-
-import org.chromium.base.CalledByNative;
-import org.chromium.base.JNINamespace;
-
-/**
- * Simple proxy to let us query the touch device from C++
- */
-@JNINamespace("ui")
-public class TouchDevice {
-
- /**
- * Static methods only so make constructor private.
- */
- private TouchDevice() { }
-
- /**
- * Returns the number of supported touch points.
- *
- * @return Maximum supported touch points.
- */
- @CalledByNative
- private static int maxTouchPoints(Context context) {
- // Android only tells us if the device belongs to a "Touchscreen Class"
- // which only guarantees a minimum number of touch points. Be
- // conservative and return the minimum, checking membership from the
- // highest class down.
- if (context.getPackageManager().hasSystemFeature(
- PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND)) {
- return 5;
- } else if (context.getPackageManager().hasSystemFeature(
- PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT)) {
- return 2;
- } else if (context.getPackageManager().hasSystemFeature(
- PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH)) {
- return 2;
- } else if (context.getPackageManager().hasSystemFeature(
- PackageManager.FEATURE_TOUCHSCREEN)) {
- return 1;
- } else {
- return 0;
- }
- }
-}
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn
index 187b84f..3535e21 100644
--- a/ui/base/BUILD.gn
+++ b/ui/base/BUILD.gn
@@ -23,18 +23,9 @@
"android/window_android_observer.h",
"cursor/cursor.h",
"hit_test.h",
- "touch/touch_device.h",
- "touch/touch_enabled.cc",
- "touch/touch_enabled.h",
"ui_base_export.h",
- "ui_base_paths.cc",
- "ui_base_paths.h",
"ui_base_switches.cc",
"ui_base_switches.h",
- "ui_base_switches_util.cc",
- "ui_base_switches_util.h",
- "ui_base_types.cc",
- "ui_base_types.h",
"view_prop.cc",
"view_prop.h",
"win/accessibility_ids_win.h",
@@ -67,17 +58,6 @@
"win/window_event_target.h",
]
- if (is_win) {
- sources += [ "touch/touch_device_win.cc" ]
- } else if (is_android) {
- sources += [ "touch/touch_device_android.cc" ]
- } else if (use_x11) {
- sources += [ "touch/touch_device_x11.cc" ]
- } else {
- # Empty implementation for all other cases.
- sources += [ "touch/touch_device.cc" ]
- }
-
defines = [ "UI_BASE_IMPLEMENTATION" ]
public_deps = [
@@ -100,10 +80,6 @@
if (use_x11) {
sources += [
- "x/x11_foreign_window_manager.cc",
- "x/x11_foreign_window_manager.h",
- "x/x11_menu_list.cc",
- "x/x11_menu_list.h",
"x/x11_util.cc",
"x/x11_util.h",
"x/x11_util_internal.h",
@@ -166,8 +142,6 @@
}
if (is_android) {
- sources -= [ "ui_base_types.cc" ]
-
deps += [ ":ui_base_jni_headers" ]
libs += [ "jnigraphics" ]
@@ -186,7 +160,6 @@
sources = [
"../android/java/src/org/chromium/ui/base/DeviceFormFactor.java",
"../android/java/src/org/chromium/ui/base/SelectFileDialog.java",
- "../android/java/src/org/chromium/ui/base/TouchDevice.java",
"../android/java/src/org/chromium/ui/base/ViewAndroid.java",
"../android/java/src/org/chromium/ui/base/WindowAndroid.java",
]
@@ -205,13 +178,10 @@
# remove 'ui_unittests' target. crbug.com/331829
test("ui_unittests") {
sources = [
- "layout_unittest.cc",
"test/run_all_unittests.cc",
]
sources += [
- "accelerators/accelerator_manager_unittest.cc",
- "accelerators/menu_label_accelerator_util_linux_unittest.cc",
"test/data/resource.h",
"view_prop_unittest.cc",
]
diff --git a/ui/base/android/ui_base_jni_registrar.cc b/ui/base/android/ui_base_jni_registrar.cc
index 72979f0..c4b357f 100644
--- a/ui/base/android/ui_base_jni_registrar.cc
+++ b/ui/base/android/ui_base_jni_registrar.cc
@@ -8,13 +8,11 @@
#include "base/android/jni_registrar.h"
#include "ui/base/android/view_android.h"
#include "ui/base/android/window_android.h"
-#include "ui/base/touch/touch_device.h"
namespace ui {
namespace android {
static base::android::RegistrationMethod kUiRegisteredMethods[] = {
- { "TouchDevice", RegisterTouchDeviceAndroid },
{ "ViewAndroid", ViewAndroid::RegisterViewAndroid },
{ "WindowAndroid", WindowAndroid::RegisterWindowAndroid },
};
diff --git a/ui/base/test/run_all_unittests.cc b/ui/base/test/run_all_unittests.cc
index cb2067a..279c0c0 100644
--- a/ui/base/test/run_all_unittests.cc
+++ b/ui/base/test/run_all_unittests.cc
@@ -8,8 +8,6 @@
#include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h"
#include "build/build_config.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/base/ui_base_paths.h"
#if defined(OS_ANDROID)
#include "base/android/jni_android.h"
@@ -64,36 +62,9 @@
#if defined(OS_MACOSX) && !defined(OS_IOS)
mock_cr_app::RegisterMockCrApp();
-
- // On Mac, a test Framework bundle is created that links locale.pak and
- // chrome_100_percent.pak at the appropriate places to ui_test.pak.
- base::mac::SetOverrideFrameworkBundlePath(
- exe_path.AppendASCII("ui_unittests Framework.framework"));
- ui::ResourceBundle::InitSharedInstanceWithLocale(
- "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES);
-
-#elif defined(OS_IOS) || defined(OS_ANDROID)
- // On iOS, the ui_unittests binary is itself a mini bundle, with resources
- // built in. On Android, ui_unittests_apk provides the necessary framework.
- ui::ResourceBundle::InitSharedInstanceWithLocale(
- "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES);
-
-#else
- // On other platforms, the (hardcoded) paths for chrome_100_percent.pak and
- // locale.pak get populated by later build steps. To avoid clobbering them,
- // load the test .pak files directly.
- ui::ResourceBundle::InitSharedInstanceWithPakPath(
- exe_path.AppendASCII("ui_test.pak"));
-
- // ui_unittests can't depend on the locales folder which Chrome will make
- // later, so use the path created by ui_test_pak.
- PathService::Override(ui::DIR_LOCALES, exe_path.AppendASCII("ui"));
-#endif
}
void UIBaseTestSuite::Shutdown() {
- ui::ResourceBundle::CleanupSharedInstance();
-
#if defined(OS_MACOSX) && !defined(OS_IOS)
base::mac::SetOverrideFrameworkBundle(NULL);
#endif
diff --git a/ui/base/touch/OWNERS b/ui/base/touch/OWNERS
deleted file mode 100644
index b8e32c1..0000000
--- a/ui/base/touch/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-sadrul@chromium.org
diff --git a/ui/base/touch/touch_device.cc b/ui/base/touch/touch_device.cc
deleted file mode 100644
index 944ba17..0000000
--- a/ui/base/touch/touch_device.cc
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/base/touch/touch_device.h"
-
-namespace ui {
-
-// Platforms supporting touch link in an alternate implementation of this
-// method.
-bool IsTouchDevicePresent() {
- return false;
-}
-
-int MaxTouchPoints() {
- return 0;
-}
-
-} // namespace ui
diff --git a/ui/base/touch/touch_device.h b/ui/base/touch/touch_device.h
deleted file mode 100644
index fd75ebc..0000000
--- a/ui/base/touch/touch_device.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_BASE_TOUCH_TOUCH_DEVICE_H_
-#define UI_BASE_TOUCH_TOUCH_DEVICE_H_
-
-#include "ui/base/ui_base_export.h"
-
-#if defined(OS_ANDROID)
-#include <jni.h>
-#endif
-
-
-namespace ui {
-
-// Returns true if a touch device is available.
-UI_BASE_EXPORT bool IsTouchDevicePresent();
-
-// Returns the maximum number of simultaneous touch contacts supported
-// by the device. In the case of devices with multiple digitizers (e.g.
-// multiple touchscreens), the value MUST be the maximum of the set of
-// maximum supported contacts by each individual digitizer.
-// For example, suppose a device has 3 touchscreens, which support 2, 5,
-// and 10 simultaneous touch contacts, respectively. This returns 10.
-// http://www.w3.org/TR/pointerevents/#widl-Navigator-maxTouchPoints
-UI_BASE_EXPORT int MaxTouchPoints();
-
-#if defined(OS_ANDROID)
-bool RegisterTouchDeviceAndroid(JNIEnv* env);
-#endif
-
-} // namespace ui
-
-#endif // UI_BASE_TOUCH_TOUCH_DEVICE_H_
diff --git a/ui/base/touch/touch_device_android.cc b/ui/base/touch/touch_device_android.cc
deleted file mode 100644
index 604306c..0000000
--- a/ui/base/touch/touch_device_android.cc
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/base/touch/touch_device.h"
-
-#include "jni/TouchDevice_jni.h"
-
-namespace ui {
-
-bool IsTouchDevicePresent() {
- return true;
-}
-
-int MaxTouchPoints() {
- JNIEnv* env = base::android::AttachCurrentThread();
- jobject context = base::android::GetApplicationContext();
- jint max_touch_points = Java_TouchDevice_maxTouchPoints(env, context);
- return static_cast<int>(max_touch_points);
-}
-
-bool RegisterTouchDeviceAndroid(JNIEnv* env) {
- return RegisterNativesImpl(env);
-}
-
-} // namespace ui
diff --git a/ui/base/touch/touch_device_win.cc b/ui/base/touch/touch_device_win.cc
deleted file mode 100644
index 18f2f12..0000000
--- a/ui/base/touch/touch_device_win.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/base/touch/touch_device.h"
-#include "base/win/windows_version.h"
-#include <windows.h>
-
-namespace ui {
-
-bool IsTouchDevicePresent() {
- int value = GetSystemMetrics(SM_DIGITIZER);
- return (value & NID_READY) &&
- ((value & NID_INTEGRATED_TOUCH) || (value & NID_EXTERNAL_TOUCH));
-}
-
-int MaxTouchPoints() {
- if (!IsTouchDevicePresent())
- return 0;
-
- return GetSystemMetrics(SM_MAXIMUMTOUCHES);
-}
-
-} // namespace ui
diff --git a/ui/base/touch/touch_device_x11.cc b/ui/base/touch/touch_device_x11.cc
deleted file mode 100644
index 998a159..0000000
--- a/ui/base/touch/touch_device_x11.cc
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/base/touch/touch_device.h"
-#include "ui/events/x/touch_factory_x11.h"
-
-namespace ui {
-
-bool IsTouchDevicePresent() {
- return ui::TouchFactory::GetInstance()->IsTouchDevicePresent();
-}
-
-int MaxTouchPoints() {
- return ui::TouchFactory::GetInstance()->GetMaxTouchPoints();
-}
-
-} // namespace ui
diff --git a/ui/base/touch/touch_enabled.cc b/ui/base/touch/touch_enabled.cc
deleted file mode 100644
index 89d3eac..0000000
--- a/ui/base/touch/touch_enabled.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/base/touch/touch_enabled.h"
-#include "base/command_line.h"
-#include "base/logging.h"
-#include "ui/base/touch/touch_device.h"
-#include "ui/base/ui_base_switches.h"
-#include "ui/events/event_switches.h"
-
-namespace ui {
-
-bool AreTouchEventsEnabled() {
- const base::CommandLine& command_line =
- *base::CommandLine::ForCurrentProcess();
- const std::string touch_enabled_switch =
- command_line.HasSwitch(switches::kTouchEvents) ?
- command_line.GetSwitchValueASCII(switches::kTouchEvents) :
- switches::kTouchEventsAuto;
-
- if (touch_enabled_switch.empty() ||
- touch_enabled_switch == switches::kTouchEventsEnabled)
- return true;
- if (touch_enabled_switch == switches::kTouchEventsAuto)
- return IsTouchDevicePresent();
- if (touch_enabled_switch != switches::kTouchEventsDisabled)
- LOG(ERROR) << "Invalid --touch-events option: " << touch_enabled_switch;
- return false;
-}
-
-} // namespace ui
diff --git a/ui/base/touch/touch_enabled.h b/ui/base/touch/touch_enabled.h
deleted file mode 100644
index 88837d7..0000000
--- a/ui/base/touch/touch_enabled.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_BASE_TOUCH_TOUCH_ENABLED_H_
-#define UI_BASE_TOUCH_TOUCH_ENABLED_H_
-
-#include "ui/base/ui_base_export.h"
-
-namespace ui {
-
-// Returns true if the touch-enabled flag is enabled, or if it is set to auto
-// and a touch device is present.
-UI_BASE_EXPORT bool AreTouchEventsEnabled();
-
-} // namespace ui
-
-#endif // UI_BASE_TOUCH_TOUCH_ENABLED_H_
diff --git a/ui/base/ui_base_paths.cc b/ui/base/ui_base_paths.cc
deleted file mode 100644
index 083315d..0000000
--- a/ui/base/ui_base_paths.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/base/ui_base_paths.h"
-
-#include "base/command_line.h"
-#include "base/files/file_path.h"
-#include "base/files/file_util.h"
-#include "base/logging.h"
-#include "base/path_service.h"
-
-#if defined(OS_ANDROID)
-#include "base/android/path_utils.h"
-#endif
-
-namespace ui {
-
-bool PathProvider(int key, base::FilePath* result) {
- // Assume that we will not need to create the directory if it does not exist.
- // This flag can be set to true for the cases where we want to create it.
- bool create_dir = false;
-
- base::FilePath cur;
- switch (key) {
- case DIR_LOCALES:
- if (!PathService::Get(base::DIR_MODULE, &cur))
- return false;
-#if defined(OS_MACOSX)
- // On Mac, locale files are in Contents/Resources, a sibling of the
- // App dir.
- cur = cur.DirName();
- cur = cur.Append(FILE_PATH_LITERAL("Resources"));
-#elif defined(OS_ANDROID)
- if (!PathService::Get(DIR_RESOURCE_PAKS_ANDROID, &cur))
- return false;
-#else
- cur = cur.Append(FILE_PATH_LITERAL("locales"));
-#endif
- create_dir = true;
- break;
- // The following are only valid in the development environment, and
- // will fail if executed from an installed executable (because the
- // generated path won't exist).
- case UI_DIR_TEST_DATA:
- if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur))
- return false;
- cur = cur.Append(FILE_PATH_LITERAL("ui"));
- cur = cur.Append(FILE_PATH_LITERAL("base"));
- cur = cur.Append(FILE_PATH_LITERAL("test"));
- cur = cur.Append(FILE_PATH_LITERAL("data"));
- if (!base::PathExists(cur)) // we don't want to create this
- return false;
- break;
-#if defined(OS_ANDROID)
- case DIR_RESOURCE_PAKS_ANDROID:
- if (!PathService::Get(base::DIR_ANDROID_APP_DATA, &cur))
- return false;
- cur = cur.Append(FILE_PATH_LITERAL("paks"));
- break;
-#endif
- case UI_TEST_PAK:
- if (!PathService::Get(base::DIR_MODULE, &cur))
- return false;
- cur = cur.AppendASCII("ui_test.pak");
- break;
- default:
- return false;
- }
-
- if (create_dir && !base::PathExists(cur) &&
- !base::CreateDirectory(cur))
- return false;
-
- *result = cur;
- return true;
-}
-
-// This cannot be done as a static initializer sadly since Visual Studio will
-// eliminate this object file if there is no direct entry point into it.
-void RegisterPathProvider() {
- PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
-}
-
-} // namespace ui
diff --git a/ui/base/ui_base_paths.h b/ui/base/ui_base_paths.h
deleted file mode 100644
index cf5e004..0000000
--- a/ui/base/ui_base_paths.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_BASE_UI_BASE_PATHS_H_
-#define UI_BASE_UI_BASE_PATHS_H_
-
-#include "build/build_config.h"
-#include "ui/base/ui_base_export.h"
-
-// This file declares path keys for various special directories. These can be
-// used with the PathService to access these directories and files.
-
-namespace ui {
-
-enum {
- PATH_START = 3000,
-
- DIR_LOCALES, // Directory where locale resources are stored.
-
- // Valid only in development environment; TODO(darin): move this
- UI_DIR_TEST_DATA, // Directory where unit test data resides.
-
-#if defined(OS_ANDROID)
- DIR_RESOURCE_PAKS_ANDROID,
-#endif
-
- UI_TEST_PAK,
-
- PATH_END
-};
-
-// Call once to register the provider for the path keys defined above.
-UI_BASE_EXPORT void RegisterPathProvider();
-
-} // namespace ui
-
-#endif // UI_BASE_UI_BASE_PATHS_H_
diff --git a/ui/base/ui_base_switches_util.cc b/ui/base/ui_base_switches_util.cc
deleted file mode 100644
index 3d4c2a2..0000000
--- a/ui/base/ui_base_switches_util.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/base/ui_base_switches_util.h"
-
-#include "base/command_line.h"
-#include "ui/base/ui_base_switches.h"
-
-using base::CommandLine;
-
-namespace switches {
-
-bool IsTextInputFocusManagerEnabled() {
- return CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTextInputFocusManager);
-}
-
-bool IsTouchDragDropEnabled() {
-#if defined(OS_CHROMEOS)
- return !CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableTouchDragDrop);
-#else
- return CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTouchDragDrop);
-#endif
-}
-
-bool IsTouchEditingEnabled() {
- return CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTouchEditing);
-}
-
-bool IsTouchFeedbackEnabled() {
- static bool touch_feedback_enabled = CommandLine::ForCurrentProcess()->
- HasSwitch(switches::kEnableTouchFeedback);
- return touch_feedback_enabled;
-}
-
-} // namespace switches
diff --git a/ui/base/ui_base_switches_util.h b/ui/base/ui_base_switches_util.h
deleted file mode 100644
index de08d1c..0000000
--- a/ui/base/ui_base_switches_util.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_BASE_UI_BASE_SWITCHES_UTIL_H_
-#define UI_BASE_UI_BASE_SWITCHES_UTIL_H_
-
-#include "ui/base/ui_base_export.h"
-
-namespace switches {
-
-UI_BASE_EXPORT bool IsTextInputFocusManagerEnabled();
-UI_BASE_EXPORT bool IsTouchDragDropEnabled();
-UI_BASE_EXPORT bool IsTouchEditingEnabled();
-UI_BASE_EXPORT bool IsTouchFeedbackEnabled();
-
-} // namespace switches
-
-#endif // UI_BASE_UI_BASE_SWITCHES_UTIL_H_
diff --git a/ui/base/ui_base_types.cc b/ui/base/ui_base_types.cc
deleted file mode 100644
index e757edb..0000000
--- a/ui/base/ui_base_types.cc
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/base/ui_base_types.h"
-
-#include "ui/events/event.h"
-
-namespace ui {
-
-MenuSourceType GetMenuSourceTypeForEvent(const ui::Event& event) {
- ui::MenuSourceType source_type = ui::MENU_SOURCE_MOUSE;
- if (event.IsKeyEvent())
- source_type = ui::MENU_SOURCE_KEYBOARD;
- if (event.IsTouchEvent() || event.IsGestureEvent())
- source_type = ui::MENU_SOURCE_TOUCH;
- return source_type;
-}
-
-} // namespace ui
diff --git a/ui/base/ui_base_types.h b/ui/base/ui_base_types.h
deleted file mode 100644
index b40815a..0000000
--- a/ui/base/ui_base_types.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_BASE_UI_BASE_TYPES_H_
-#define UI_BASE_UI_BASE_TYPES_H_
-
-#include "ui/base/ui_base_export.h"
-
-namespace ui {
-
-class Event;
-
-// Window "show" state.
-enum WindowShowState {
- // A default un-set state.
- SHOW_STATE_DEFAULT = 0,
- SHOW_STATE_NORMAL = 1,
- SHOW_STATE_MINIMIZED = 2,
- SHOW_STATE_MAXIMIZED = 3,
- SHOW_STATE_INACTIVE = 4, // Views only, not persisted.
- SHOW_STATE_FULLSCREEN = 5,
- SHOW_STATE_END = 6 // The end of show state enum.
-};
-
-// Dialog button identifiers used to specify which buttons to show the user.
-enum DialogButton {
- DIALOG_BUTTON_NONE = 0,
- DIALOG_BUTTON_OK = 1,
- DIALOG_BUTTON_CANCEL = 2,
-};
-
-// Specifies the type of modality applied to a window. Different modal
-// treatments may be handled differently by the window manager.
-enum ModalType {
- MODAL_TYPE_NONE = 0, // Window is not modal.
- MODAL_TYPE_WINDOW = 1, // Window is modal to its transient parent.
- MODAL_TYPE_CHILD = 2, // Window is modal to a child of its transient parent.
- MODAL_TYPE_SYSTEM = 3 // Window is modal to all other windows.
-};
-
-// TODO(varunjain): Remove MENU_SOURCE_NONE (crbug.com/250964)
-enum MenuSourceType {
- MENU_SOURCE_NONE = 0,
- MENU_SOURCE_MOUSE = 1,
- MENU_SOURCE_KEYBOARD = 2,
- MENU_SOURCE_TOUCH = 3,
- MENU_SOURCE_TOUCH_EDIT_MENU = 4,
- MENU_SOURCE_TYPE_LAST = MENU_SOURCE_TOUCH_EDIT_MENU
-};
-
-UI_BASE_EXPORT MenuSourceType GetMenuSourceTypeForEvent(const ui::Event& event);
-
-} // namespace ui
-
-#endif // UI_BASE_UI_BASE_TYPES_H_
diff --git a/ui/base/x/x11_foreign_window_manager.cc b/ui/base/x/x11_foreign_window_manager.cc
deleted file mode 100644
index 39029d0..0000000
--- a/ui/base/x/x11_foreign_window_manager.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/base/x/x11_foreign_window_manager.h"
-
-#include <X11/Xlib.h>
-
-#include "base/memory/singleton.h"
-
-namespace ui {
-
-// static
-XForeignWindowManager* XForeignWindowManager::GetInstance() {
- return Singleton<XForeignWindowManager>::get();
-}
-
-int XForeignWindowManager::RequestEvents(XID xid, long event_mask) {
- request_map_[xid].push_back(Request(next_request_id_, event_mask));
- UpdateSelectedEvents(xid);
- return next_request_id_++;
-}
-
-void XForeignWindowManager::CancelRequest(int request_id) {
- for (std::map<XID, RequestVector>::iterator map_it = request_map_.begin();
- map_it != request_map_.end(); ++map_it) {
- RequestVector* vector = &map_it->second;
- for (RequestVector::iterator vector_it = vector->begin();
- vector_it != vector->end(); ++vector_it) {
- if (vector_it->request_id == request_id) {
- vector->erase(vector_it);
- UpdateSelectedEvents(map_it->first);
- if (vector->empty())
- request_map_.erase(map_it);
- return;
- }
- }
- }
-}
-
-void XForeignWindowManager::OnWindowDestroyed(XID xid) {
- request_map_.erase(xid);
-}
-
-XForeignWindowManager::XForeignWindowManager() : next_request_id_(0) {
-}
-
-XForeignWindowManager::~XForeignWindowManager() {
-}
-
-void XForeignWindowManager::UpdateSelectedEvents(XID xid) {
- std::map<XID, RequestVector>::iterator it = request_map_.find(xid);
- if (it == request_map_.end())
- return;
-
- long event_mask = NoEventMask;
- const RequestVector& list = it->second;
- for (size_t i = 0; i < list.size(); ++i)
- event_mask |= list[i].event_mask;
-
- XSelectInput(gfx::GetXDisplay(), xid, event_mask);
-}
-
-XForeignWindowManager::Request::Request(int request_id, long event_mask)
- : request_id(request_id),
- event_mask(event_mask) {
-}
-
-XForeignWindowManager::Request::~Request() {
-}
-
-} // namespace ui
diff --git a/ui/base/x/x11_foreign_window_manager.h b/ui/base/x/x11_foreign_window_manager.h
deleted file mode 100644
index 354cfba..0000000
--- a/ui/base/x/x11_foreign_window_manager.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_BASE_X_X11_FOREIGN_WINDOW_MANAGER_H_
-#define UI_BASE_X_X11_FOREIGN_WINDOW_MANAGER_H_
-
-#include <map>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "ui/base/ui_base_export.h"
-#include "ui/gfx/x/x11_types.h"
-
-// A process wide singleton for selecting events on X windows which were not
-// created by Chrome.
-template <typename T> struct DefaultSingletonTraits;
-
-namespace ui {
-
-// Manages the events that Chrome has selected on X windows which were not
-// created by Chrome. This class allows several clients to select events
-// on the same X window.
-class UI_BASE_EXPORT XForeignWindowManager {
- public:
- static XForeignWindowManager* GetInstance();
-
- // Requests that events associated with |event_mask| on |xid| be reported to
- // Chrome. Returns an id to use for canceling the request.
- int RequestEvents(XID xid, long event_mask) WARN_UNUSED_RESULT;
-
- // Cancels the request with |request_id|. Unless there is another request for
- // events on the X window associated with |request_id|, this stops Chrome from
- // getting events for the X window.
- void CancelRequest(int request_id);
-
- // Called by X11DesktopHandler when |xid| is destroyed.
- void OnWindowDestroyed(XID xid);
-
- private:
- friend struct DefaultSingletonTraits<XForeignWindowManager>;
-
- struct Request {
- Request(int request_id, long entry_event_mask);
- ~Request();
-
- int request_id;
- long event_mask;
- };
-
- XForeignWindowManager();
- ~XForeignWindowManager();
-
- // Updates which events are selected on |xid|.
- void UpdateSelectedEvents(XID xid);
-
- // The id of the next request.
- int next_request_id_;
-
- typedef std::vector<Request> RequestVector;
- std::map<XID, RequestVector> request_map_;
-
- DISALLOW_COPY_AND_ASSIGN(XForeignWindowManager);
-};
-
-} // namespace ui
-
-#endif // UI_BASE_X_X11_FOREIGN_WINDOW_MANAGER_H_
diff --git a/ui/base/x/x11_menu_list.cc b/ui/base/x/x11_menu_list.cc
deleted file mode 100644
index d9b94b7..0000000
--- a/ui/base/x/x11_menu_list.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/base/x/x11_menu_list.h"
-
-#include "base/memory/singleton.h"
-#include "ui/base/x/x11_util.h"
-
-namespace ui {
-
-// static
-XMenuList* XMenuList::GetInstance() {
- return Singleton<XMenuList>::get();
-}
-
-XMenuList::XMenuList()
- : menu_type_atom_(GetAtom("_NET_WM_WINDOW_TYPE_MENU")) {
-}
-
-XMenuList::~XMenuList() {
- menus_.clear();
-}
-
-void XMenuList::MaybeRegisterMenu(XID menu) {
- int value = 0;
- if (!GetIntProperty(menu, "_NET_WM_WINDOW_TYPE", &value) ||
- static_cast<XAtom>(value) != menu_type_atom_) {
- return;
- }
- menus_.push_back(menu);
-}
-
-void XMenuList::MaybeUnregisterMenu(XID menu) {
- std::vector<XID>::iterator iter = std::find(menus_.begin(), menus_.end(),
- menu);
- if (iter == menus_.end())
- return;
- menus_.erase(iter);
-}
-
-void XMenuList::InsertMenuWindowXIDs(std::vector<XID>* stack) {
- stack->insert(stack->begin(), menus_.begin(), menus_.end());
-}
-
-} // namespace ui
diff --git a/ui/base/x/x11_menu_list.h b/ui/base/x/x11_menu_list.h
deleted file mode 100644
index 9946fd6..0000000
--- a/ui/base/x/x11_menu_list.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_BASE_X_X11_MENU_LIST_H_
-#define UI_BASE_X_X11_MENU_LIST_H_
-
-#include <vector>
-
-#include "base/basictypes.h"
-#include "ui/base/ui_base_export.h"
-#include "ui/gfx/x/x11_types.h"
-
-// A process wide singleton cache for X menus.
-template <typename T> struct DefaultSingletonTraits;
-
-namespace ui {
-
-// Keeps track of created and destroyed top level menu windows.
-class UI_BASE_EXPORT XMenuList {
- public:
- static XMenuList* GetInstance();
-
- // Checks if |menu| has _NET_WM_WINDOW_TYPE property set to
- // "_NET_WM_WINDOW_TYPE_MENU" atom and if so caches it.
- void MaybeRegisterMenu(XID menu);
-
- // Finds |menu| in cache and if found removes it.
- void MaybeUnregisterMenu(XID menu);
-
- // Inserts cached menu XIDs at the beginning of |stack|.
- void InsertMenuWindowXIDs(std::vector<XID>* stack);
-
- private:
- friend struct DefaultSingletonTraits<XMenuList>;
- XMenuList();
- ~XMenuList();
-
- std::vector<XID> menus_;
- XAtom menu_type_atom_;
- DISALLOW_COPY_AND_ASSIGN(XMenuList);
-};
-
-} // namespace ui
-
-#endif // UI_BASE_X_X11_MENU_LIST_H_
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc
index 2451601..dedc882 100644
--- a/ui/base/x/x11_util.cc
+++ b/ui/base/x/x11_util.cc
@@ -36,7 +36,6 @@
#include "skia/ext/image_operations.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkPostConfig.h"
-#include "ui/base/x/x11_menu_list.h"
#include "ui/base/x/x11_util_internal.h"
#include "ui/events/event_utils.h"
#include "ui/events/keycodes/keyboard_code_conversion_x.h"
@@ -1084,81 +1083,6 @@
return true;
}
-bool EnumerateChildren(EnumerateWindowsDelegate* delegate, XID window,
- const int max_depth, int depth) {
- if (depth > max_depth)
- return false;
-
- std::vector<XID> windows;
- std::vector<XID>::iterator iter;
- if (depth == 0) {
- XMenuList::GetInstance()->InsertMenuWindowXIDs(&windows);
- // Enumerate the menus first.
- for (iter = windows.begin(); iter != windows.end(); iter++) {
- if (delegate->ShouldStopIterating(*iter))
- return true;
- }
- windows.clear();
- }
-
- XID root, parent, *children;
- unsigned int num_children;
- int status = XQueryTree(gfx::GetXDisplay(), window, &root, &parent, &children,
- &num_children);
- if (status == 0)
- return false;
-
- for (int i = static_cast<int>(num_children) - 1; i >= 0; i--)
- windows.push_back(children[i]);
-
- XFree(children);
-
- // XQueryTree returns the children of |window| in bottom-to-top order, so
- // reverse-iterate the list to check the windows from top-to-bottom.
- for (iter = windows.begin(); iter != windows.end(); iter++) {
- if (IsWindowNamed(*iter) && delegate->ShouldStopIterating(*iter))
- return true;
- }
-
- // If we're at this point, we didn't find the window we're looking for at the
- // current level, so we need to recurse to the next level. We use a second
- // loop because the recursion and call to XQueryTree are expensive and is only
- // needed for a small number of cases.
- if (++depth <= max_depth) {
- for (iter = windows.begin(); iter != windows.end(); iter++) {
- if (EnumerateChildren(delegate, *iter, max_depth, depth))
- return true;
- }
- }
-
- return false;
-}
-
-bool EnumerateAllWindows(EnumerateWindowsDelegate* delegate, int max_depth) {
- XID root = GetX11RootWindow();
- return EnumerateChildren(delegate, root, max_depth, 0);
-}
-
-void EnumerateTopLevelWindows(ui::EnumerateWindowsDelegate* delegate) {
- std::vector<XID> stack;
- if (!ui::GetXWindowStack(ui::GetX11RootWindow(), &stack)) {
- // Window Manager doesn't support _NET_CLIENT_LIST_STACKING, so fall back
- // to old school enumeration of all X windows. Some WMs parent 'top-level'
- // windows in unnamed actual top-level windows (ion WM), so extend the
- // search depth to all children of top-level windows.
- const int kMaxSearchDepth = 1;
- ui::EnumerateAllWindows(delegate, kMaxSearchDepth);
- return;
- }
- XMenuList::GetInstance()->InsertMenuWindowXIDs(&stack);
-
- std::vector<XID>::iterator iter;
- for (iter = stack.begin(); iter != stack.end(); iter++) {
- if (delegate->ShouldStopIterating(*iter))
- return;
- }
-}
-
bool GetXWindowStack(Window window, std::vector<XID>* windows) {
windows->clear();
diff --git a/ui/base/x/x11_util.h b/ui/base/x/x11_util.h
index b989677..e8e5f04 100644
--- a/ui/base/x/x11_util.h
+++ b/ui/base/x/x11_util.h
@@ -218,27 +218,6 @@
// Translates an X11 error code into a printable string.
UI_BASE_EXPORT std::string GetX11ErrorString(XDisplay* display, int err);
-// Implementers of this interface receive a notification for every X window of
-// the main display.
-class EnumerateWindowsDelegate {
- public:
- // |xid| is the X Window ID of the enumerated window. Return true to stop
- // further iteration.
- virtual bool ShouldStopIterating(XID xid) = 0;
-
- protected:
- virtual ~EnumerateWindowsDelegate() {}
-};
-
-// Enumerates all windows in the current display. Will recurse into child
-// windows up to a depth of |max_depth|.
-UI_BASE_EXPORT bool EnumerateAllWindows(EnumerateWindowsDelegate* delegate,
- int max_depth);
-
-// Enumerates the top-level windows of the current display.
-UI_BASE_EXPORT void EnumerateTopLevelWindows(
- ui::EnumerateWindowsDelegate* delegate);
-
// Returns all children windows of a given window in top-to-bottom stacking
// order.
UI_BASE_EXPORT bool GetXWindowStack(XID window, std::vector<XID>* windows);
diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn
index c27c86a..34a1d79 100644
--- a/ui/gfx/BUILD.gn
+++ b/ui/gfx/BUILD.gn
@@ -226,7 +226,6 @@
"geometry/vector2d_unittest.cc",
"geometry/vector3d_unittest.cc",
"sequential_id_generator_unittest.cc",
- "shadow_value_unittest.cc",
"skrect_conversion_unittest.cc",
"transform_util_unittest.cc",
]
diff --git a/ui/gfx/test/run_all_unittests.cc b/ui/gfx/test/run_all_unittests.cc
index 1483929..80fbe67 100644
--- a/ui/gfx/test/run_all_unittests.cc
+++ b/ui/gfx/test/run_all_unittests.cc
@@ -9,8 +9,6 @@
#include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/base/ui_base_paths.h"
#if defined(OS_ANDROID)
#include "base/android/jni_android.h"
@@ -38,16 +36,9 @@
#if defined(OS_MACOSX) && !defined(OS_IOS)
mock_cr_app::RegisterMockCrApp();
#endif
-
- ui::RegisterPathProvider();
-
- base::FilePath ui_test_pak_path;
- ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
- ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
}
void Shutdown() override {
- ui::ResourceBundle::CleanupSharedInstance();
base::TestSuite::Shutdown();
}