Commit 3f396851 authored by thanhph's avatar thanhph Committed by Commit Bot

Move DevTools out of ash and turn it to a component. AshTestbase

dependency will be removed and replaced by ViewTestBase. Appropriate
UIElement trees are also created to test DevTools.

BUG=701835

Review-Url: https://codereview.chromium.org/2899783002
Cr-Commit-Position: refs/heads/master@{#481047}
parent 3db9563b
...@@ -79,19 +79,6 @@ component("ash") { ...@@ -79,19 +79,6 @@ component("ash") {
"default_accessibility_delegate.h", "default_accessibility_delegate.h",
"default_wallpaper_delegate.cc", "default_wallpaper_delegate.cc",
"default_wallpaper_delegate.h", "default_wallpaper_delegate.h",
"devtools/ash_devtools_css_agent.cc",
"devtools/ash_devtools_css_agent.h",
"devtools/ash_devtools_dom_agent.cc",
"devtools/ash_devtools_dom_agent.h",
"devtools/ui_element.cc",
"devtools/ui_element.h",
"devtools/ui_element_delegate.h",
"devtools/view_element.cc",
"devtools/view_element.h",
"devtools/widget_element.cc",
"devtools/widget_element.h",
"devtools/window_element.cc",
"devtools/window_element.h",
"display/ash_display_controller.cc", "display/ash_display_controller.cc",
"display/ash_display_controller.h", "display/ash_display_controller.h",
"display/cursor_window_controller.cc", "display/cursor_window_controller.cc",
...@@ -856,6 +843,7 @@ component("ash") { ...@@ -856,6 +843,7 @@ component("ash") {
"//components/session_manager:base", "//components/session_manager:base",
"//components/signin/core/account_id", "//components/signin/core/account_id",
"//components/ui_devtools", "//components/ui_devtools",
"//components/ui_devtools/views",
"//components/user_manager", "//components/user_manager",
"//components/vector_icons", "//components/vector_icons",
"//components/wallpaper", "//components/wallpaper",
...@@ -1166,7 +1154,6 @@ source_set("common_unittests") { ...@@ -1166,7 +1154,6 @@ source_set("common_unittests") {
"accelerators/spoken_feedback_toggler_unittest.cc", "accelerators/spoken_feedback_toggler_unittest.cc",
"ash_touch_exploration_manager_chromeos_unittest.cc", "ash_touch_exploration_manager_chromeos_unittest.cc",
"autoclick/autoclick_unittest.cc", "autoclick/autoclick_unittest.cc",
"devtools/ash_devtools_unittest.cc",
"display/display_configuration_controller_unittest.cc", "display/display_configuration_controller_unittest.cc",
"drag_drop/drag_image_view_unittest.cc", "drag_drop/drag_image_view_unittest.cc",
"first_run/first_run_helper_unittest.cc", "first_run/first_run_helper_unittest.cc",
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#include "ash/aura/shell_port_classic.h" #include "ash/aura/shell_port_classic.h"
#include "ash/autoclick/autoclick_controller.h" #include "ash/autoclick/autoclick_controller.h"
#include "ash/cast_config_controller.h" #include "ash/cast_config_controller.h"
#include "ash/devtools/ash_devtools_css_agent.h"
#include "ash/devtools/ash_devtools_dom_agent.h"
#include "ash/display/ash_display_controller.h" #include "ash/display/ash_display_controller.h"
#include "ash/display/cursor_window_controller.h" #include "ash/display/cursor_window_controller.h"
#include "ash/display/display_color_manager_chromeos.h" #include "ash/display/display_color_manager_chromeos.h"
...@@ -133,6 +131,8 @@ ...@@ -133,6 +131,8 @@
#include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/ui_devtools/devtools_server.h" #include "components/ui_devtools/devtools_server.h"
#include "components/ui_devtools/views/ui_devtools_css_agent.h"
#include "components/ui_devtools/views/ui_devtools_dom_agent.h"
#include "services/preferences/public/cpp/pref_service_factory.h" #include "services/preferences/public/cpp/pref_service_factory.h"
#include "services/preferences/public/interfaces/preferences.mojom.h" #include "services/preferences/public/interfaces/preferences.mojom.h"
#include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/connector.h"
...@@ -856,12 +856,12 @@ void Shell::Init(const ShellInitParams& init_params) { ...@@ -856,12 +856,12 @@ void Shell::Init(const ShellInitParams& init_params) {
wallpaper_controller_ = base::MakeUnique<WallpaperController>(); wallpaper_controller_ = base::MakeUnique<WallpaperController>();
// Start devtools server // Start devtools server
devtools_server_ = ui::devtools::UiDevToolsServer::Create(nullptr); devtools_server_ = ui_devtools::UiDevToolsServer::Create(nullptr);
if (devtools_server_) { if (devtools_server_) {
auto dom_backend = base::MakeUnique<devtools::AshDevToolsDOMAgent>(); auto dom_backend = base::MakeUnique<ui_devtools::UIDevToolsDOMAgent>();
auto css_backend = auto css_backend =
base::MakeUnique<devtools::AshDevToolsCSSAgent>(dom_backend.get()); base::MakeUnique<ui_devtools::UIDevToolsCSSAgent>(dom_backend.get());
auto devtools_client = base::MakeUnique<ui::devtools::UiDevToolsClient>( auto devtools_client = base::MakeUnique<ui_devtools::UiDevToolsClient>(
"Ash", devtools_server_.get()); "Ash", devtools_server_.get());
devtools_client->AddAgent(std::move(dom_backend)); devtools_client->AddAgent(std::move(dom_backend));
devtools_client->AddAgent(std::move(css_backend)); devtools_client->AddAgent(std::move(css_backend));
......
...@@ -60,9 +60,10 @@ class Insets; ...@@ -60,9 +60,10 @@ class Insets;
namespace ui { namespace ui {
class UserActivityDetector; class UserActivityDetector;
class UserActivityPowerManagerNotifier; class UserActivityPowerManagerNotifier;
namespace devtools {
class UiDevToolsServer;
} }
namespace ui_devtools {
class UiDevToolsServer;
} }
namespace views { namespace views {
...@@ -718,7 +719,7 @@ class ASH_EXPORT Shell : public SessionObserver, ...@@ -718,7 +719,7 @@ class ASH_EXPORT Shell : public SessionObserver,
std::unique_ptr<::wm::WindowModalityController> window_modality_controller_; std::unique_ptr<::wm::WindowModalityController> window_modality_controller_;
std::unique_ptr<app_list::AppList> app_list_; std::unique_ptr<app_list::AppList> app_list_;
std::unique_ptr<::PrefService> pref_service_; std::unique_ptr<::PrefService> pref_service_;
std::unique_ptr<ui::devtools::UiDevToolsServer> devtools_server_; std::unique_ptr<ui_devtools::UiDevToolsServer> devtools_server_;
std::unique_ptr<views::corewm::TooltipController> tooltip_controller_; std::unique_ptr<views::corewm::TooltipController> tooltip_controller_;
LinkHandlerModelFactory* link_handler_model_factory_; LinkHandlerModelFactory* link_handler_model_factory_;
std::unique_ptr<PowerButtonController> power_button_controller_; std::unique_ptr<PowerButtonController> power_button_controller_;
......
...@@ -2726,9 +2726,9 @@ const FeatureEntry kFeatureEntries[] = { ...@@ -2726,9 +2726,9 @@ const FeatureEntry kFeatureEntries[] = {
#endif // OS_ANDROID #endif // OS_ANDROID
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
{ui::devtools::kEnableUiDevTools, flag_descriptions::kUiDevToolsName, {ui_devtools::kEnableUiDevTools, flag_descriptions::kUiDevToolsName,
flag_descriptions::kUiDevToolsDescription, kOsCrOS, flag_descriptions::kUiDevToolsDescription, kOsCrOS,
SINGLE_VALUE_TYPE(ui::devtools::kEnableUiDevTools)}, SINGLE_VALUE_TYPE(ui_devtools::kEnableUiDevTools)},
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
{"enable-autofill-credit-card-last-used-date-display", {"enable-autofill-credit-card-last-used-date-display",
...@@ -3146,7 +3146,7 @@ bool SkipConditionalFeatureEntry(const FeatureEntry& entry) { ...@@ -3146,7 +3146,7 @@ bool SkipConditionalFeatureEntry(const FeatureEntry& entry) {
} }
// enable-ui-devtools is only available on for non Stable channels. // enable-ui-devtools is only available on for non Stable channels.
if (!strcmp(ui::devtools::kEnableUiDevTools, entry.internal_name) && if (!strcmp(ui_devtools::kEnableUiDevTools, entry.internal_name) &&
channel == version_info::Channel::STABLE) { channel == version_info::Channel::STABLE) {
return true; return true;
} }
......
...@@ -68,7 +68,7 @@ const char kIsAdditionalField[] = "isAdditional"; ...@@ -68,7 +68,7 @@ const char kIsAdditionalField[] = "isAdditional";
void GetUiDevToolsTargets(base::ListValue& targets) { void GetUiDevToolsTargets(base::ListValue& targets) {
for (const auto& client_pair : for (const auto& client_pair :
ui::devtools::UiDevToolsServer::GetClientNamesAndUrls()) { ui_devtools::UiDevToolsServer::GetClientNamesAndUrls()) {
auto target_data = base::MakeUnique<base::DictionaryValue>(); auto target_data = base::MakeUnique<base::DictionaryValue>();
target_data->SetString(kNameField, client_pair.first); target_data->SetString(kNameField, client_pair.first);
target_data->SetString(kUrlField, client_pair.second); target_data->SetString(kUrlField, client_pair.second);
......
...@@ -157,6 +157,10 @@ test("components_unittests") { ...@@ -157,6 +157,10 @@ test("components_unittests") {
"//components/webdata/common:unit_tests", "//components/webdata/common:unit_tests",
] ]
if (toolkit_views && use_aura) {
deps += [ "//components/ui_devtools/views:unit_tests" ]
}
if (enable_nacl) { if (enable_nacl) {
deps += [ "//components/nacl/browser:unit_tests" ] deps += [ "//components/nacl/browser:unit_tests" ]
} }
......
...@@ -52,7 +52,7 @@ inspector_protocol_generate("protocol_generated_sources") { ...@@ -52,7 +52,7 @@ inspector_protocol_generate("protocol_generated_sources") {
outputs = _protocol_generated outputs = _protocol_generated
} }
source_set("ui_devtools") { component("ui_devtools") {
sources = rebase_path(_protocol_generated, ".", target_gen_dir) sources = rebase_path(_protocol_generated, ".", target_gen_dir)
sources += [ sources += [
"devtools_base_agent.h", "devtools_base_agent.h",
......
# Inspecting Chrome Native UI with DevTools.
https://www.chromium.org/developers/how-tos/inspecting-ash
...@@ -7,8 +7,7 @@ ...@@ -7,8 +7,7 @@
#include "components/ui_devtools/Protocol.h" #include "components/ui_devtools/Protocol.h"
namespace ui { namespace ui_devtools {
namespace devtools {
class UiDevToolsAgent { class UiDevToolsAgent {
public: public:
...@@ -39,12 +38,12 @@ class UiDevToolsBaseAgent : public UiDevToolsAgent, ...@@ -39,12 +38,12 @@ class UiDevToolsBaseAgent : public UiDevToolsAgent,
// Common methods between all generated Backends, subclasses may // Common methods between all generated Backends, subclasses may
// choose to override them (but not necessary). // choose to override them (but not necessary).
ui::devtools::protocol::Response enable() override { ui_devtools::protocol::Response enable() override {
return ui::devtools::protocol::Response::OK(); return ui_devtools::protocol::Response::OK();
}; };
ui::devtools::protocol::Response disable() override { ui_devtools::protocol::Response disable() override {
return ui::devtools::protocol::Response::OK(); return ui_devtools::protocol::Response::OK();
}; };
protected: protected:
...@@ -59,7 +58,6 @@ class UiDevToolsBaseAgent : public UiDevToolsAgent, ...@@ -59,7 +58,6 @@ class UiDevToolsBaseAgent : public UiDevToolsAgent,
DISALLOW_COPY_AND_ASSIGN(UiDevToolsBaseAgent); DISALLOW_COPY_AND_ASSIGN(UiDevToolsBaseAgent);
}; };
} // namespace devtools } // namespace ui_devtools
} // namespace ui
#endif // COMPONENTS_UI_DEVTOOLS_DEVTOOLS_BASE_AGENT_H_ #endif // COMPONENTS_UI_DEVTOOLS_DEVTOOLS_BASE_AGENT_H_
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
#include "components/ui_devtools/devtools_server.h" #include "components/ui_devtools/devtools_server.h"
namespace ui { namespace ui_devtools {
namespace devtools {
UiDevToolsClient::UiDevToolsClient(const std::string& name, UiDevToolsClient::UiDevToolsClient(const std::string& name,
UiDevToolsServer* server) UiDevToolsServer* server)
...@@ -68,5 +67,4 @@ void UiDevToolsClient::flushProtocolNotifications() { ...@@ -68,5 +67,4 @@ void UiDevToolsClient::flushProtocolNotifications() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
} // namespace devtools } // namespace ui_devtools
} // namespace ui
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
#include "components/ui_devtools/Forward.h" #include "components/ui_devtools/Forward.h"
#include "components/ui_devtools/Protocol.h" #include "components/ui_devtools/Protocol.h"
#include "components/ui_devtools/devtools_base_agent.h" #include "components/ui_devtools/devtools_base_agent.h"
#include "components/ui_devtools/devtools_export.h"
namespace ui { namespace ui_devtools {
namespace devtools {
class UiDevToolsServer; class UiDevToolsServer;
...@@ -21,7 +21,7 @@ class UiDevToolsServer; ...@@ -21,7 +21,7 @@ class UiDevToolsServer;
// this class and attach the corresponding backends/frontends (i.e: DOM, CSS, // this class and attach the corresponding backends/frontends (i.e: DOM, CSS,
// etc). This client is then attached to the UiDevToolsServer and all messages // etc). This client is then attached to the UiDevToolsServer and all messages
// from this client are sent over the web socket owned by the server. // from this client are sent over the web socket owned by the server.
class UiDevToolsClient : public protocol::FrontendChannel { class UI_DEVTOOLS_EXPORT UiDevToolsClient : public protocol::FrontendChannel {
public: public:
static const int kNotConnected = -1; static const int kNotConnected = -1;
...@@ -57,7 +57,6 @@ class UiDevToolsClient : public protocol::FrontendChannel { ...@@ -57,7 +57,6 @@ class UiDevToolsClient : public protocol::FrontendChannel {
DISALLOW_COPY_AND_ASSIGN(UiDevToolsClient); DISALLOW_COPY_AND_ASSIGN(UiDevToolsClient);
}; };
} // namespace devtools } // namespace ui_devtools
} // namespace ui
#endif // COMPONENTS_UI_DEVTOOLS_DEVTOOLS_CLIENT_H_ #endif // COMPONENTS_UI_DEVTOOLS_DEVTOOLS_CLIENT_H_
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
#include "net/socket/server_socket.h" #include "net/socket/server_socket.h"
#include "net/socket/tcp_server_socket.h" #include "net/socket/tcp_server_socket.h"
namespace ui { namespace ui_devtools {
namespace devtools {
namespace { namespace {
const char kChromeDeveloperToolsPrefix[] = const char kChromeDeveloperToolsPrefix[] =
...@@ -182,5 +181,4 @@ void UiDevToolsServer::OnClose(int connection_id) { ...@@ -182,5 +181,4 @@ void UiDevToolsServer::OnClose(int connection_id) {
connections_.erase(it); connections_.erase(it);
} }
} // namespace devtools } // namespace ui_devtools
} // namespace ui
...@@ -14,13 +14,14 @@ ...@@ -14,13 +14,14 @@
#include "components/ui_devtools/Forward.h" #include "components/ui_devtools/Forward.h"
#include "components/ui_devtools/Protocol.h" #include "components/ui_devtools/Protocol.h"
#include "components/ui_devtools/devtools_client.h" #include "components/ui_devtools/devtools_client.h"
#include "components/ui_devtools/devtools_export.h"
#include "components/ui_devtools/string_util.h" #include "components/ui_devtools/string_util.h"
#include "net/server/http_server.h" #include "net/server/http_server.h"
namespace ui { namespace ui_devtools {
namespace devtools {
class UiDevToolsServer : public net::HttpServer::Delegate { class UI_DEVTOOLS_EXPORT UiDevToolsServer
: public NON_EXPORTED_BASE(net::HttpServer::Delegate) {
public: public:
~UiDevToolsServer() override; ~UiDevToolsServer() override;
...@@ -68,7 +69,6 @@ class UiDevToolsServer : public net::HttpServer::Delegate { ...@@ -68,7 +69,6 @@ class UiDevToolsServer : public net::HttpServer::Delegate {
DISALLOW_COPY_AND_ASSIGN(UiDevToolsServer); DISALLOW_COPY_AND_ASSIGN(UiDevToolsServer);
}; };
} // namespace devtools } // namespace ui_devtools
} // namespace ui
#endif // COMPONENTS_UI_DEVTOOLS_DEVTOOLS_SERVER_H_ #endif // COMPONENTS_UI_DEVTOOLS_DEVTOOLS_SERVER_H_
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"path": "protocol.json", "path": "protocol.json",
"package": "components/ui_devtools", "package": "components/ui_devtools",
"output": "", "output": "",
"namespace": ["ui", "devtools", "protocol"], "namespace": ["ui_devtools", "protocol"],
"export_macro": "UI_DEVTOOLS_EXPORT", "export_macro": "UI_DEVTOOLS_EXPORT",
"export_header": "components/ui_devtools/devtools_export.h" "export_header": "components/ui_devtools/devtools_export.h"
}, },
......
...@@ -7,8 +7,7 @@ ...@@ -7,8 +7,7 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "components/ui_devtools/Protocol.h" #include "components/ui_devtools/Protocol.h"
namespace ui { namespace ui_devtools {
namespace devtools {
namespace protocol { namespace protocol {
// static // static
...@@ -20,5 +19,4 @@ std::unique_ptr<Value> StringUtil::parseJSON(const String& string) { ...@@ -20,5 +19,4 @@ std::unique_ptr<Value> StringUtil::parseJSON(const String& string) {
}; };
} // namespace protocol } // namespace protocol
} // namespace ws } // namespace ui_devtools
} // namespace ui
...@@ -10,8 +10,7 @@ ...@@ -10,8 +10,7 @@
#include "base/json/json_reader.h" #include "base/json/json_reader.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
namespace ui { namespace ui_devtools {
namespace devtools {
using String = std::string; using String = std::string;
...@@ -28,9 +27,7 @@ class CustomStringBuilder { ...@@ -28,9 +27,7 @@ class CustomStringBuilder {
void reserveCapacity(std::size_t size) { s_.reserve(size); } void reserveCapacity(std::size_t size) { s_.reserve(size); }
void append(const String& s) { s_ += s; } void append(const String& s) { s_ += s; }
void append(char c) { s_ += c; } void append(char c) { s_ += c; }
void append(const char* data, unsigned int length) { void append(const char* data, size_t length) { s_.append(data, length); }
s_.append(data, length);
}
String toString() { return s_; } String toString() { return s_; }
}; };
...@@ -76,7 +73,6 @@ class StringUtil { ...@@ -76,7 +73,6 @@ class StringUtil {
}; };
} // namespace protocol } // namespace protocol
} // namespace devtools } // namespace ui_devtools
} // namespace ui
#endif // COMPONENTS_UI_DEVTOOLS_STRING_UTIL_H_ #endif // COMPONENTS_UI_DEVTOOLS_STRING_UTIL_H_
...@@ -4,12 +4,10 @@ ...@@ -4,12 +4,10 @@
#include "components/ui_devtools/switches.h" #include "components/ui_devtools/switches.h"
namespace ui { namespace ui_devtools {
namespace devtools {
// Enables DevTools server for UI (mus, ash, etc). Value should be the port the // Enables DevTools server for UI (mus, ash, etc). Value should be the port the
// server is started on. Default port is 9332. // server is started on. Default port is 9332.
const char kEnableUiDevTools[] = "enable-ui-devtools"; const char kEnableUiDevTools[] = "enable-ui-devtools";
} // namespace devtools } // namespace ui_devtools
} // namespace ui
...@@ -7,12 +7,10 @@ ...@@ -7,12 +7,10 @@
#include "components/ui_devtools/devtools_export.h" #include "components/ui_devtools/devtools_export.h"
namespace ui { namespace ui_devtools {
namespace devtools {
extern UI_DEVTOOLS_EXPORT const char kEnableUiDevTools[]; extern UI_DEVTOOLS_EXPORT const char kEnableUiDevTools[];
} // namespace devtools } // namespace ui_devtools
} // namespace ui
#endif // COMPONENTS_UI_DEVTOOLS_SWITCHES_H_ #endif // COMPONENTS_UI_DEVTOOLS_SWITCHES_H_
# Copyright 2016 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.
import("//build/config/ui.gni")
source_set("views") {
cflags = []
if (is_win) {
cflags += [ "/wd4800" ] # Value forced to bool.
}
sources = [
"ui_devtools_css_agent.cc",
"ui_devtools_css_agent.h",
"ui_devtools_dom_agent.cc",
"ui_devtools_dom_agent.h",
"ui_element.cc",
"ui_element.h",
"ui_element_delegate.h",
"view_element.cc",
"view_element.h",
"widget_element.cc",
"widget_element.h",
"window_element.cc",
"window_element.h",
]
deps = [
"//components/ui_devtools",
"//skia",
"//ui/aura",
"//ui/views",
"//ui/wm:wm",
]
}
source_set("unit_tests") {
testonly = true
cflags = []
if (is_win) {
cflags += [ "/wd4800" ] # Value forced to bool.
}
sources = [
"ui_devtools_unittest.cc",
]
deps = [
":views",
"//components/ui_devtools",
"//skia",
"//testing/gtest",
"//ui/aura",
"//ui/views",
"//ui/views:test_support",
"//ui/wm:wm",
]
configs += [ "//build/config:precompiled_headers" ]
}
include_rules = [
"+third_party/skia/include/core",
"+ui"
]
...@@ -2,18 +2,17 @@ ...@@ -2,18 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ash/devtools/ash_devtools_css_agent.h" #include "components/ui_devtools/views/ui_devtools_css_agent.h"
#include "ash/devtools/ui_element.h"
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "components/ui_devtools/views/ui_element.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
namespace ash { namespace ui_devtools {
namespace devtools {
namespace { namespace {
using namespace ui::devtools::protocol; using namespace ui_devtools::protocol;
const char kHeight[] = "height"; const char kHeight[] = "height";
const char kWidth[] = "width"; const char kWidth[] = "width";
...@@ -66,8 +65,8 @@ std::unique_ptr<CSS::CSSStyle> BuildCSSStyle(int node_id, ...@@ -66,8 +65,8 @@ std::unique_ptr<CSS::CSSStyle> BuildCSSStyle(int node_id,
.build(); .build();
} }
ui::devtools::protocol::Response NodeNotFoundError(int node_id) { ui_devtools::protocol::Response NodeNotFoundError(int node_id) {
return ui::devtools::protocol::Response::Error( return ui_devtools::protocol::Response::Error(
"Node with id=" + std::to_string(node_id) + " not found"); "Node with id=" + std::to_string(node_id) + " not found");
} }
...@@ -100,57 +99,57 @@ Response ParseProperties(const std::string& style_text, ...@@ -100,57 +99,57 @@ Response ParseProperties(const std::string& style_text,
} // namespace } // namespace
AshDevToolsCSSAgent::AshDevToolsCSSAgent(AshDevToolsDOMAgent* dom_agent) UIDevToolsCSSAgent::UIDevToolsCSSAgent(UIDevToolsDOMAgent* dom_agent)
: dom_agent_(dom_agent) { : dom_agent_(dom_agent) {
DCHECK(dom_agent_); DCHECK(dom_agent_);
} }
AshDevToolsCSSAgent::~AshDevToolsCSSAgent() { UIDevToolsCSSAgent::~UIDevToolsCSSAgent() {
disable(); disable();
} }
ui::devtools::protocol::Response AshDevToolsCSSAgent::enable() { ui_devtools::protocol::Response UIDevToolsCSSAgent::enable() {
dom_agent_->AddObserver(this); dom_agent_->AddObserver(this);
return ui::devtools::protocol::Response::OK(); return ui_devtools::protocol::Response::OK();
} }
ui::devtools::protocol::Response AshDevToolsCSSAgent::disable() { ui_devtools::protocol::Response UIDevToolsCSSAgent::disable() {
dom_agent_->RemoveObserver(this); dom_agent_->RemoveObserver(this);
return ui::devtools::protocol::Response::OK(); return ui_devtools::protocol::Response::OK();
} }
ui::devtools::protocol::Response AshDevToolsCSSAgent::getMatchedStylesForNode( ui_devtools::protocol::Response UIDevToolsCSSAgent::getMatchedStylesForNode(
int node_id, int node_id,
ui::devtools::protocol::Maybe<ui::devtools::protocol::CSS::CSSStyle>* ui_devtools::protocol::Maybe<ui_devtools::protocol::CSS::CSSStyle>*
inline_style) { inline_style) {
*inline_style = GetStylesForNode(node_id); *inline_style = GetStylesForNode(node_id);
if (!inline_style) if (!inline_style)
return NodeNotFoundError(node_id); return NodeNotFoundError(node_id);
return ui::devtools::protocol::Response::OK(); return ui_devtools::protocol::Response::OK();
} }
ui::devtools::protocol::Response AshDevToolsCSSAgent::setStyleTexts( ui_devtools::protocol::Response UIDevToolsCSSAgent::setStyleTexts(
std::unique_ptr<ui::devtools::protocol::Array< std::unique_ptr<ui_devtools::protocol::Array<
ui::devtools::protocol::CSS::StyleDeclarationEdit>> edits, ui_devtools::protocol::CSS::StyleDeclarationEdit>> edits,
std::unique_ptr< std::unique_ptr<
ui::devtools::protocol::Array<ui::devtools::protocol::CSS::CSSStyle>>* ui_devtools::protocol::Array<ui_devtools::protocol::CSS::CSSStyle>>*
result) { result) {
std::unique_ptr< std::unique_ptr<
ui::devtools::protocol::Array<ui::devtools::protocol::CSS::CSSStyle>> ui_devtools::protocol::Array<ui_devtools::protocol::CSS::CSSStyle>>
updated_styles = ui::devtools::protocol::Array< updated_styles = ui_devtools::protocol::Array<
ui::devtools::protocol::CSS::CSSStyle>::create(); ui_devtools::protocol::CSS::CSSStyle>::create();
for (size_t i = 0; i < edits->length(); i++) { for (size_t i = 0; i < edits->length(); i++) {
auto* edit = edits->get(i); auto* edit = edits->get(i);
int node_id; int node_id;
if (!base::StringToInt(edit->getStyleSheetId(), &node_id)) if (!base::StringToInt(edit->getStyleSheetId(), &node_id))
return ui::devtools::protocol::Response::Error("Invalid node id"); return ui_devtools::protocol::Response::Error("Invalid node id");
gfx::Rect updated_bounds; gfx::Rect updated_bounds;
bool visible = false; bool visible = false;
if (!GetPropertiesForNodeId(node_id, &updated_bounds, &visible)) if (!GetPropertiesForNodeId(node_id, &updated_bounds, &visible))
return NodeNotFoundError(node_id); return NodeNotFoundError(node_id);
ui::devtools::protocol::Response response( ui_devtools::protocol::Response response(
ParseProperties(edit->getText(), &updated_bounds, &visible)); ParseProperties(edit->getText(), &updated_bounds, &visible));
if (!response.isSuccess()) if (!response.isSuccess())
return response; return response;
...@@ -161,15 +160,15 @@ ui::devtools::protocol::Response AshDevToolsCSSAgent::setStyleTexts( ...@@ -161,15 +160,15 @@ ui::devtools::protocol::Response AshDevToolsCSSAgent::setStyleTexts(
return NodeNotFoundError(node_id); return NodeNotFoundError(node_id);
} }
*result = std::move(updated_styles); *result = std::move(updated_styles);
return ui::devtools::protocol::Response::OK(); return ui_devtools::protocol::Response::OK();
} }
void AshDevToolsCSSAgent::OnNodeBoundsChanged(int node_id) { void UIDevToolsCSSAgent::OnNodeBoundsChanged(int node_id) {
InvalidateStyleSheet(node_id); InvalidateStyleSheet(node_id);
} }
std::unique_ptr<ui::devtools::protocol::CSS::CSSStyle> std::unique_ptr<ui_devtools::protocol::CSS::CSSStyle>
AshDevToolsCSSAgent::GetStylesForNode(int node_id) { UIDevToolsCSSAgent::GetStylesForNode(int node_id) {
gfx::Rect bounds; gfx::Rect bounds;
bool visible = false; bool visible = false;
return GetPropertiesForNodeId(node_id, &bounds, &visible) return GetPropertiesForNodeId(node_id, &bounds, &visible)
...@@ -177,14 +176,14 @@ AshDevToolsCSSAgent::GetStylesForNode(int node_id) { ...@@ -177,14 +176,14 @@ AshDevToolsCSSAgent::GetStylesForNode(int node_id) {
: nullptr; : nullptr;
} }
void AshDevToolsCSSAgent::InvalidateStyleSheet(int node_id) { void UIDevToolsCSSAgent::InvalidateStyleSheet(int node_id) {
// The stylesheetId for each node is equivalent to its node_id (as a string). // The stylesheetId for each node is equivalent to its node_id (as a string).
frontend()->styleSheetChanged(base::IntToString(node_id)); frontend()->styleSheetChanged(base::IntToString(node_id));
} }
bool AshDevToolsCSSAgent::GetPropertiesForNodeId(int node_id, bool UIDevToolsCSSAgent::GetPropertiesForNodeId(int node_id,
gfx::Rect* bounds, gfx::Rect* bounds,
bool* visible) { bool* visible) {
UIElement* ui_element = dom_agent_->GetElementFromNodeId(node_id); UIElement* ui_element = dom_agent_->GetElementFromNodeId(node_id);
if (ui_element) { if (ui_element) {
ui_element->GetBounds(bounds); ui_element->GetBounds(bounds);
...@@ -194,9 +193,9 @@ bool AshDevToolsCSSAgent::GetPropertiesForNodeId(int node_id, ...@@ -194,9 +193,9 @@ bool AshDevToolsCSSAgent::GetPropertiesForNodeId(int node_id,
return false; return false;
} }
bool AshDevToolsCSSAgent::SetPropertiesForNodeId(int node_id, bool UIDevToolsCSSAgent::SetPropertiesForNodeId(int node_id,
const gfx::Rect& bounds, const gfx::Rect& bounds,
bool visible) { bool visible) {
UIElement* ui_element = dom_agent_->GetElementFromNodeId(node_id); UIElement* ui_element = dom_agent_->GetElementFromNodeId(node_id);
if (ui_element) { if (ui_element) {
ui_element->SetBounds(bounds); ui_element->SetBounds(bounds);
...@@ -206,5 +205,4 @@ bool AshDevToolsCSSAgent::SetPropertiesForNodeId(int node_id, ...@@ -206,5 +205,4 @@ bool AshDevToolsCSSAgent::SetPropertiesForNodeId(int node_id,
return false; return false;
} }
} // namespace devtools } // namespace ui_devtools
} // namespace ash
...@@ -2,56 +2,52 @@ ...@@ -2,56 +2,52 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef ASH_DEVTOOLS_ASH_DEVTOOLS_CSS_AGENT_H_ #ifndef COMPONENTS_UI_DEVTOOLS_VIEWS_UI_DEVTOOLS_CSS_AGENT_H_
#define ASH_DEVTOOLS_ASH_DEVTOOLS_CSS_AGENT_H_ #define COMPONENTS_UI_DEVTOOLS_VIEWS_UI_DEVTOOLS_CSS_AGENT_H_
#include "ash/ash_export.h"
#include "ash/devtools/ash_devtools_dom_agent.h"
#include "base/macros.h" #include "base/macros.h"
#include "components/ui_devtools/CSS.h" #include "components/ui_devtools/CSS.h"
#include "components/ui_devtools/views/ui_devtools_dom_agent.h"
namespace ash { namespace ui_devtools {
namespace devtools {
class ASH_EXPORT AshDevToolsCSSAgent class UIDevToolsCSSAgent : public ui_devtools::UiDevToolsBaseAgent<
: public NON_EXPORTED_BASE(ui::devtools::UiDevToolsBaseAgent< ui_devtools::protocol::CSS::Metainfo>,
ui::devtools::protocol::CSS::Metainfo>), public UIDevToolsDOMAgentObserver {
public AshDevToolsDOMAgentObserver {
public: public:
explicit AshDevToolsCSSAgent(AshDevToolsDOMAgent* dom_agent); explicit UIDevToolsCSSAgent(UIDevToolsDOMAgent* dom_agent);
~AshDevToolsCSSAgent() override; ~UIDevToolsCSSAgent() override;
// CSS::Backend: // CSS::Backend:
ui::devtools::protocol::Response enable() override; ui_devtools::protocol::Response enable() override;
ui::devtools::protocol::Response disable() override; ui_devtools::protocol::Response disable() override;
ui::devtools::protocol::Response getMatchedStylesForNode( ui_devtools::protocol::Response getMatchedStylesForNode(
int node_id, int node_id,
ui::devtools::protocol::Maybe<ui::devtools::protocol::CSS::CSSStyle>* ui_devtools::protocol::Maybe<ui_devtools::protocol::CSS::CSSStyle>*
inline_style) override; inline_style) override;
ui::devtools::protocol::Response setStyleTexts( ui_devtools::protocol::Response setStyleTexts(
std::unique_ptr<ui::devtools::protocol::Array< std::unique_ptr<ui_devtools::protocol::Array<
ui::devtools::protocol::CSS::StyleDeclarationEdit>> edits, ui_devtools::protocol::CSS::StyleDeclarationEdit>> edits,
std::unique_ptr< std::unique_ptr<
ui::devtools::protocol::Array<ui::devtools::protocol::CSS::CSSStyle>>* ui_devtools::protocol::Array<ui_devtools::protocol::CSS::CSSStyle>>*
result) override; result) override;
// AshDevToolsDOMAgentObserver: // UIDevToolsDOMAgentObserver:
void OnNodeBoundsChanged(int node_id) override; void OnNodeBoundsChanged(int node_id) override;
private: private:
std::unique_ptr<ui::devtools::protocol::CSS::CSSStyle> GetStylesForNode( std::unique_ptr<ui_devtools::protocol::CSS::CSSStyle> GetStylesForNode(
int node_id); int node_id);
void InvalidateStyleSheet(int node_id); void InvalidateStyleSheet(int node_id);
bool GetPropertiesForNodeId(int node_id, gfx::Rect* bounds, bool* visible); bool GetPropertiesForNodeId(int node_id, gfx::Rect* bounds, bool* visible);
bool SetPropertiesForNodeId(int node_id, bool SetPropertiesForNodeId(int node_id,
const gfx::Rect& bounds, const gfx::Rect& bounds,
bool visible); bool visible);
AshDevToolsDOMAgent* dom_agent_; UIDevToolsDOMAgent* dom_agent_;
DISALLOW_COPY_AND_ASSIGN(AshDevToolsCSSAgent); DISALLOW_COPY_AND_ASSIGN(UIDevToolsCSSAgent);
}; };
} // namespace devtools } // namespace ui_devtools
} // namespace ash
#endif // ASH_DEVTOOLS_ASH_DEVTOOLS_CSS_AGENT_H_ #endif // COMPONENTS_UI_DEVTOOLS_VIEWS_UI_DEVTOOLS_CSS_AGENT_H_
...@@ -2,14 +2,12 @@ ...@@ -2,14 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef ASH_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ #ifndef COMPONENTS_UI_DEVTOOLS_VIEWS_UI_DEVTOOLS_DOM_AGENT_H_
#define ASH_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ #define COMPONENTS_UI_DEVTOOLS_VIEWS_UI_DEVTOOLS_DOM_AGENT_H_
#include "ash/ash_export.h"
#include "ash/devtools/ui_element_delegate.h"
#include "base/macros.h"
#include "components/ui_devtools/DOM.h" #include "components/ui_devtools/DOM.h"
#include "components/ui_devtools/devtools_base_agent.h" #include "components/ui_devtools/devtools_base_agent.h"
#include "components/ui_devtools/views/ui_element_delegate.h"
#include "ui/aura/env_observer.h" #include "ui/aura/env_observer.h"
#include "ui/views/view.h" #include "ui/views/view.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
...@@ -18,35 +16,33 @@ namespace aura { ...@@ -18,35 +16,33 @@ namespace aura {
class Window; class Window;
} }
namespace ash { namespace ui_devtools {
namespace devtools {
class UIElement; class UIElement;
class ASH_EXPORT AshDevToolsDOMAgentObserver { class UIDevToolsDOMAgentObserver {
public: public:
// TODO(thanhph): Use UIElement* as input argument instead. // TODO(thanhph): Use UIElement* as input argument instead.
virtual void OnNodeBoundsChanged(int node_id) = 0; virtual void OnNodeBoundsChanged(int node_id) = 0;
}; };
class ASH_EXPORT AshDevToolsDOMAgent class UIDevToolsDOMAgent : public ui_devtools::UiDevToolsBaseAgent<
: public NON_EXPORTED_BASE(ui::devtools::UiDevToolsBaseAgent< ui_devtools::protocol::DOM::Metainfo>,
ui::devtools::protocol::DOM::Metainfo>), public UIElementDelegate,
public UIElementDelegate, public aura::EnvObserver {
public aura::EnvObserver {
public: public:
AshDevToolsDOMAgent(); UIDevToolsDOMAgent();
~AshDevToolsDOMAgent() override; ~UIDevToolsDOMAgent() override;
// DOM::Backend: // DOM::Backend:
ui::devtools::protocol::Response disable() override; ui_devtools::protocol::Response disable() override;
ui::devtools::protocol::Response getDocument( ui_devtools::protocol::Response getDocument(
std::unique_ptr<ui::devtools::protocol::DOM::Node>* out_root) override; std::unique_ptr<ui_devtools::protocol::DOM::Node>* out_root) override;
ui::devtools::protocol::Response highlightNode( ui_devtools::protocol::Response highlightNode(
std::unique_ptr<ui::devtools::protocol::DOM::HighlightConfig> std::unique_ptr<ui_devtools::protocol::DOM::HighlightConfig>
highlight_config, highlight_config,
ui::devtools::protocol::Maybe<int> node_id) override; ui_devtools::protocol::Maybe<int> node_id) override;
ui::devtools::protocol::Response hideHighlight() override; ui_devtools::protocol::Response hideHighlight() override;
// UIElementDelegate: // UIElementDelegate:
void OnUIElementAdded(UIElement* parent, UIElement* child) override; void OnUIElementAdded(UIElement* parent, UIElement* child) override;
...@@ -55,8 +51,8 @@ class ASH_EXPORT AshDevToolsDOMAgent ...@@ -55,8 +51,8 @@ class ASH_EXPORT AshDevToolsDOMAgent
void OnUIElementBoundsChanged(UIElement* ui_element) override; void OnUIElementBoundsChanged(UIElement* ui_element) override;
bool IsHighlightingWindow(aura::Window* window) override; bool IsHighlightingWindow(aura::Window* window) override;
void AddObserver(AshDevToolsDOMAgentObserver* observer); void AddObserver(UIDevToolsDOMAgentObserver* observer);
void RemoveObserver(AshDevToolsDOMAgentObserver* observer); void RemoveObserver(UIDevToolsDOMAgentObserver* observer);
UIElement* GetElementFromNodeId(int node_id); UIElement* GetElementFromNodeId(int node_id);
UIElement* window_element_root() const { return window_element_root_.get(); }; UIElement* window_element_root() const { return window_element_root_.get(); };
const std::vector<aura::Window*>& root_windows() const { const std::vector<aura::Window*>& root_windows() const {
...@@ -69,16 +65,16 @@ class ASH_EXPORT AshDevToolsDOMAgent ...@@ -69,16 +65,16 @@ class ASH_EXPORT AshDevToolsDOMAgent
void OnHostInitialized(aura::WindowTreeHost* host) override; void OnHostInitialized(aura::WindowTreeHost* host) override;
void OnNodeBoundsChanged(int node_id); void OnNodeBoundsChanged(int node_id);
std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildInitialTree(); std::unique_ptr<ui_devtools::protocol::DOM::Node> BuildInitialTree();
std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForUIElement( std::unique_ptr<ui_devtools::protocol::DOM::Node> BuildTreeForUIElement(
UIElement* ui_element); UIElement* ui_element);
std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForWindow( std::unique_ptr<ui_devtools::protocol::DOM::Node> BuildTreeForWindow(
UIElement* window_element_root, UIElement* window_element_root,
aura::Window* window); aura::Window* window);
std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForRootWidget( std::unique_ptr<ui_devtools::protocol::DOM::Node> BuildTreeForRootWidget(
UIElement* widget_element, UIElement* widget_element,
views::Widget* widget); views::Widget* widget);
std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForView( std::unique_ptr<ui_devtools::protocol::DOM::Node> BuildTreeForView(
UIElement* view_element, UIElement* view_element,
views::View* view); views::View* view);
void RemoveDomNode(UIElement* ui_element); void RemoveDomNode(UIElement* ui_element);
...@@ -88,8 +84,8 @@ class ASH_EXPORT AshDevToolsDOMAgent ...@@ -88,8 +84,8 @@ class ASH_EXPORT AshDevToolsDOMAgent
const std::pair<aura::Window*, gfx::Rect>& window_and_bounds, const std::pair<aura::Window*, gfx::Rect>& window_and_bounds,
SkColor background, SkColor background,
SkColor border); SkColor border);
ui::devtools::protocol::Response HighlightNode( ui_devtools::protocol::Response HighlightNode(
std::unique_ptr<ui::devtools::protocol::DOM::HighlightConfig> std::unique_ptr<ui_devtools::protocol::DOM::HighlightConfig>
highlight_config, highlight_config,
int node_id); int node_id);
...@@ -98,12 +94,11 @@ class ASH_EXPORT AshDevToolsDOMAgent ...@@ -98,12 +94,11 @@ class ASH_EXPORT AshDevToolsDOMAgent
std::unordered_map<int, UIElement*> node_id_to_ui_element_; std::unordered_map<int, UIElement*> node_id_to_ui_element_;
std::unique_ptr<views::Widget> widget_for_highlighting_; std::unique_ptr<views::Widget> widget_for_highlighting_;
std::vector<aura::Window*> root_windows_; std::vector<aura::Window*> root_windows_;
base::ObserverList<AshDevToolsDOMAgentObserver> observers_; base::ObserverList<UIDevToolsDOMAgentObserver> observers_;
DISALLOW_COPY_AND_ASSIGN(AshDevToolsDOMAgent); DISALLOW_COPY_AND_ASSIGN(UIDevToolsDOMAgent);
}; };
} // namespace devtools } // namespace ui_devtools
} // namespace ash
#endif // ASH_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ #endif // COMPONENTS_UI_DEVTOOLS_VIEWS_UI_DEVTOOLS_DOM_AGENT_H_
...@@ -2,17 +2,16 @@ ...@@ -2,17 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ash/devtools/ui_element.h" #include "components/ui_devtools/views/ui_element.h"
#include <algorithm> #include <algorithm>
#include "ash/devtools/ui_element_delegate.h" #include "components/ui_devtools/views/ui_element_delegate.h"
#include "ash/devtools/view_element.h" #include "components/ui_devtools/views/view_element.h"
#include "ash/devtools/widget_element.h" #include "components/ui_devtools/views/widget_element.h"
#include "ash/devtools/window_element.h" #include "components/ui_devtools/views/window_element.h"
namespace ash { namespace ui_devtools {
namespace devtools {
namespace { namespace {
static int node_ids = 0; static int node_ids = 0;
...@@ -63,7 +62,7 @@ void UIElement::ReorderChild(UIElement* child, int new_index) { ...@@ -63,7 +62,7 @@ void UIElement::ReorderChild(UIElement* child, int new_index) {
children_.erase(iter); children_.erase(iter);
// Move child to new position |new_index| in vector |children_|. // Move child to new position |new_index| in vector |children_|.
new_index = std::min(children_.size() - 1, static_cast<size_t>(new_index)); new_index = std::min(static_cast<int>(children_.size()) - 1, new_index);
iter = children_.begin() + new_index; iter = children_.begin() + new_index;
children_.insert(iter, child); children_.insert(iter, child);
delegate()->OnUIElementReordered(child->parent(), child); delegate()->OnUIElementReordered(child->parent(), child);
...@@ -76,5 +75,4 @@ UIElement::UIElement(const UIElementType type, ...@@ -76,5 +75,4 @@ UIElement::UIElement(const UIElementType type,
delegate_->OnUIElementAdded(0, this); delegate_->OnUIElementAdded(0, this);
} }
} // namespace devtools } // namespace ui_devtools
} // namespace ash
...@@ -2,26 +2,24 @@ ...@@ -2,26 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef ASH_DEVTOOLS_UI_ELEMENT_H_ #ifndef COMPONENTS_UI_DEVTOOLS_VIEWS_UI_ELEMENT_H_
#define ASH_DEVTOOLS_UI_ELEMENT_H_ #define COMPONENTS_UI_DEVTOOLS_VIEWS_UI_ELEMENT_H_
#include <vector> #include <vector>
#include "ash/ash_export.h"
#include "base/macros.h" #include "base/macros.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/views/view.h" #include "ui/views/view.h"
namespace ash { namespace ui_devtools {
namespace devtools {
class UIElementDelegate; class UIElementDelegate;
// UIElement type. // UIElement type.
enum UIElementType { WINDOW, WIDGET, VIEW }; enum UIElementType { WINDOW, WIDGET, VIEW };
class ASH_EXPORT UIElement { class UIElement {
public: public:
virtual ~UIElement(); virtual ~UIElement();
int node_id() const { return node_id_; }; int node_id() const { return node_id_; };
...@@ -72,7 +70,6 @@ class ASH_EXPORT UIElement { ...@@ -72,7 +70,6 @@ class ASH_EXPORT UIElement {
DISALLOW_COPY_AND_ASSIGN(UIElement); DISALLOW_COPY_AND_ASSIGN(UIElement);
}; };
} // namespace devtools } // namespace ui_devtools
} // namespace ash
#endif // ASH_DEVTOOLS_UI_ELEMENT_H_ #endif // COMPONENTS_UI_DEVTOOLS_VIEWS_UI_ELEMENT_H_
...@@ -2,21 +2,19 @@ ...@@ -2,21 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef ASH_DEVTOOLS_UI_ELEMENT_DELEGATE_H_ #ifndef COMPONENTS_UI_DEVTOOLS_VIEWS_UI_ELEMENT_DELEGATE_H_
#define ASH_DEVTOOLS_UI_ELEMENT_DELEGATE_H_ #define COMPONENTS_UI_DEVTOOLS_VIEWS_UI_ELEMENT_DELEGATE_H_
#include <vector> #include <vector>
#include "ash/ash_export.h"
#include "base/macros.h" #include "base/macros.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
namespace ash { namespace ui_devtools {
namespace devtools {
class UIElement; class UIElement;
class ASH_EXPORT UIElementDelegate { class UIElementDelegate {
public: public:
UIElementDelegate(){}; UIElementDelegate(){};
virtual ~UIElementDelegate(){}; virtual ~UIElementDelegate(){};
...@@ -38,7 +36,6 @@ class ASH_EXPORT UIElementDelegate { ...@@ -38,7 +36,6 @@ class ASH_EXPORT UIElementDelegate {
DISALLOW_COPY_AND_ASSIGN(UIElementDelegate); DISALLOW_COPY_AND_ASSIGN(UIElementDelegate);
}; };
} // namespace devtools } // namespace ui_devtools
} // namespace ash
#endif // ASH_DEVTOOLS_UI_ELEMENT_DELEGATE_H_ #endif // COMPONENTS_UI_DEVTOOLS_VIEWS_UI_ELEMENT_DELEGATE_H_
...@@ -2,13 +2,12 @@ ...@@ -2,13 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ash/devtools/view_element.h" #include "components/ui_devtools/views/view_element.h"
#include "ash/devtools/ui_element_delegate.h" #include "components/ui_devtools/views/ui_element_delegate.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
namespace ash { namespace ui_devtools {
namespace devtools {
ViewElement::ViewElement(views::View* view, ViewElement::ViewElement(views::View* view,
UIElementDelegate* ui_element_delegate, UIElementDelegate* ui_element_delegate,
...@@ -85,5 +84,4 @@ views::View* ViewElement::From(UIElement* element) { ...@@ -85,5 +84,4 @@ views::View* ViewElement::From(UIElement* element) {
return static_cast<ViewElement*>(element)->view_; return static_cast<ViewElement*>(element)->view_;
} }
} // namespace devtools } // namespace ui_devtools
} // namespace ash
...@@ -2,23 +2,21 @@ ...@@ -2,23 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef ASH_DEVTOOLS_VIEW_ELEMENT_H_ #ifndef COMPONENTS_UI_DEVTOOLS_VIEWS_VIEW_ELEMENT_H_
#define ASH_DEVTOOLS_VIEW_ELEMENT_H_ #define COMPONENTS_UI_DEVTOOLS_VIEWS_VIEW_ELEMENT_H_
#include "ash/ash_export.h"
#include "ash/devtools/ui_element.h"
#include "base/macros.h" #include "base/macros.h"
#include "components/ui_devtools/views/ui_element.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/views/view.h" #include "ui/views/view.h"
#include "ui/views/view_observer.h" #include "ui/views/view_observer.h"
namespace ash { namespace ui_devtools {
namespace devtools {
class UIElementDelegate; class UIElementDelegate;
class ASH_EXPORT ViewElement : public views::ViewObserver, public UIElement { class ViewElement : public views::ViewObserver, public UIElement {
public: public:
ViewElement(views::View* view, ViewElement(views::View* view,
UIElementDelegate* ui_element_delegate, UIElementDelegate* ui_element_delegate,
...@@ -46,7 +44,6 @@ class ASH_EXPORT ViewElement : public views::ViewObserver, public UIElement { ...@@ -46,7 +44,6 @@ class ASH_EXPORT ViewElement : public views::ViewObserver, public UIElement {
DISALLOW_COPY_AND_ASSIGN(ViewElement); DISALLOW_COPY_AND_ASSIGN(ViewElement);
}; };
} // namespace devtools } // namespace ui_devtools
} // namespace ash
#endif // ASH_DEVTOOLS_VIEW_ELEMENT_H_ #endif // COMPONENTS_UI_DEVTOOLS_VIEWS_VIEW_ELEMENT_H_
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ash/devtools/widget_element.h" #include "components/ui_devtools/views/widget_element.h"
#include "ash/devtools/ui_element_delegate.h" #include "components/ui_devtools/views/ui_element_delegate.h"
namespace ash { namespace ui_devtools {
namespace devtools {
WidgetElement::WidgetElement(views::Widget* widget, WidgetElement::WidgetElement(views::Widget* widget,
UIElementDelegate* ui_element_delegate, UIElementDelegate* ui_element_delegate,
...@@ -69,5 +68,4 @@ views::Widget* WidgetElement::From(UIElement* element) { ...@@ -69,5 +68,4 @@ views::Widget* WidgetElement::From(UIElement* element) {
return static_cast<WidgetElement*>(element)->widget_; return static_cast<WidgetElement*>(element)->widget_;
} }
} // namespace devtools } // namespace ui_devtools
} // namespace ash
...@@ -2,26 +2,24 @@ ...@@ -2,26 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef ASH_DEVTOOLS_WIDGET_ELEMENT_H_ #ifndef COMPONENTS_UI_DEVTOOLS_VIEWS_WIDGET_ELEMENT_H_
#define ASH_DEVTOOLS_WIDGET_ELEMENT_H_ #define COMPONENTS_UI_DEVTOOLS_VIEWS_WIDGET_ELEMENT_H_
#include "ash/ash_export.h"
#include "ash/devtools/ui_element.h"
#include "base/macros.h" #include "base/macros.h"
#include "components/ui_devtools/views/ui_element.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_observer.h" #include "ui/views/widget/widget_observer.h"
#include "ui/views/widget/widget_removals_observer.h" #include "ui/views/widget/widget_removals_observer.h"
namespace ash { namespace ui_devtools {
namespace devtools {
class UIElementDelegate; class UIElementDelegate;
class ASH_EXPORT WidgetElement : public views::WidgetRemovalsObserver, class WidgetElement : public views::WidgetRemovalsObserver,
public views::WidgetObserver, public views::WidgetObserver,
public UIElement { public UIElement {
public: public:
WidgetElement(views::Widget* widget, WidgetElement(views::Widget* widget,
UIElementDelegate* ui_element_delegate, UIElementDelegate* ui_element_delegate,
...@@ -51,7 +49,6 @@ class ASH_EXPORT WidgetElement : public views::WidgetRemovalsObserver, ...@@ -51,7 +49,6 @@ class ASH_EXPORT WidgetElement : public views::WidgetRemovalsObserver,
DISALLOW_COPY_AND_ASSIGN(WidgetElement); DISALLOW_COPY_AND_ASSIGN(WidgetElement);
}; };
} // namespace devtools } // namespace ui_devtools
} // namespace ash
#endif // ASH_DEVTOOLS_WIDGET_ELEMENT_H_ #endif // COMPONENTS_UI_DEVTOOLS_VIEWS_WIDGET_ELEMENT_H_
...@@ -2,13 +2,12 @@ ...@@ -2,13 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ash/devtools/window_element.h" #include "components/ui_devtools/views/window_element.h"
#include "ash/devtools/ui_element_delegate.h" #include "components/ui_devtools/views/ui_element_delegate.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
namespace ash { namespace ui_devtools {
namespace devtools {
namespace { namespace {
int GetIndexOfChildInParent(aura::Window* window) { int GetIndexOfChildInParent(aura::Window* window) {
...@@ -96,5 +95,4 @@ aura::Window* WindowElement::From(UIElement* element) { ...@@ -96,5 +95,4 @@ aura::Window* WindowElement::From(UIElement* element) {
return static_cast<WindowElement*>(element)->window_; return static_cast<WindowElement*>(element)->window_;
} }
} // namespace devtools } // namespace ui_devtools
} // namespace ash
...@@ -2,20 +2,18 @@ ...@@ -2,20 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef ASH_DEVTOOLS_WINDOW_ELEMENT_H_ #ifndef COMPONENTS_UI_DEVTOOLS_VIEWS_WINDOW_ELEMENT_H_
#define ASH_DEVTOOLS_WINDOW_ELEMENT_H_ #define COMPONENTS_UI_DEVTOOLS_VIEWS_WINDOW_ELEMENT_H_
#include "ash/ash_export.h"
#include "ash/devtools/ui_element.h"
#include "base/macros.h" #include "base/macros.h"
#include "components/ui_devtools/views/ui_element.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/aura/window_observer.h" #include "ui/aura/window_observer.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
namespace ash { namespace ui_devtools {
namespace devtools {
class ASH_EXPORT WindowElement : public aura::WindowObserver, public UIElement { class WindowElement : public aura::WindowObserver, public UIElement {
public: public:
WindowElement(aura::Window* window, WindowElement(aura::Window* window,
UIElementDelegate* ui_element_delegate, UIElementDelegate* ui_element_delegate,
...@@ -48,7 +46,6 @@ class ASH_EXPORT WindowElement : public aura::WindowObserver, public UIElement { ...@@ -48,7 +46,6 @@ class ASH_EXPORT WindowElement : public aura::WindowObserver, public UIElement {
DISALLOW_COPY_AND_ASSIGN(WindowElement); DISALLOW_COPY_AND_ASSIGN(WindowElement);
}; };
} // namespace devtools } // namespace ui_devtools
} // namespace ash
#endif // ASH_DEVTOOLS_WINDOW_ELEMENT_H_ #endif // COMPONENTS_UI_DEVTOOLS_VIEWS_WINDOW_ELEMENT_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment