diff options
-rw-r--r-- | ash/accelerators/accelerator_controller.cc | 12 | ||||
-rw-r--r-- | ash/accelerators/accelerator_table.cc | 3 | ||||
-rw-r--r-- | ash/accelerators/accelerator_table.h | 1 | ||||
-rw-r--r-- | ash/ash.gyp | 1 | ||||
-rw-r--r-- | ash/ash_switches.cc | 3 | ||||
-rw-r--r-- | ash/ash_switches.h | 1 | ||||
-rw-r--r-- | build/all.gyp | 1 | ||||
-rw-r--r-- | chrome/app/generated_resources.grd | 6 | ||||
-rw-r--r-- | chrome/browser/about_flags.cc | 9 | ||||
-rw-r--r-- | ui/oak/DEPS | 8 | ||||
-rw-r--r-- | ui/oak/oak.gyp | 49 | ||||
-rw-r--r-- | ui/oak/oak.h | 17 | ||||
-rw-r--r-- | ui/oak/oak_aura_window_display.cc | 162 | ||||
-rw-r--r-- | ui/oak/oak_aura_window_display.h | 37 | ||||
-rw-r--r-- | ui/oak/oak_details_model.h | 33 | ||||
-rw-r--r-- | ui/oak/oak_export.h | 32 | ||||
-rw-r--r-- | ui/oak/oak_pretty_print.cc | 43 | ||||
-rw-r--r-- | ui/oak/oak_pretty_print.h | 31 | ||||
-rw-r--r-- | ui/oak/oak_tree_model.cc | 39 | ||||
-rw-r--r-- | ui/oak/oak_tree_model.h | 26 | ||||
-rw-r--r-- | ui/oak/oak_window.cc | 159 | ||||
-rw-r--r-- | ui/oak/oak_window.h | 67 |
22 files changed, 0 insertions, 740 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index b7a51cf..f89a4aa 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -67,7 +67,6 @@ #include "ui/events/event.h" #include "ui/events/keycodes/keyboard_codes.h" #include "ui/gfx/screen.h" -#include "ui/oak/oak.h" #include "ui/views/controls/webview/webview.h" #include "ui/views/debug_utils.h" #include "ui/views/widget/widget.h" @@ -455,15 +454,6 @@ void HandleShowMessageCenterBubble() { } } -bool HandleShowOak() { - if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kAshEnableOak)) { - oak::ShowOakWindowWithContext(Shell::GetPrimaryRootWindow()); - return true; - } - return false; -} - bool HandleShowSystemTrayBubble() { base::RecordAction(UserMetricsAction("Accel_Show_System_Tray_Bubble")); internal::RootWindowController* controller = @@ -1039,8 +1029,6 @@ bool AcceleratorController::PerformAction(int action, return HandleRotatePaneFocus(Shell::BACKWARD); case SHOW_KEYBOARD_OVERLAY: return HandleShowKeyboardOverlay(); - case SHOW_OAK: - return HandleShowOak(); case SHOW_SYSTEM_TRAY_BUBBLE: return HandleShowSystemTrayBubble(); case SHOW_MESSAGE_CENTER_BUBBLE: diff --git a/ash/accelerators/accelerator_table.cc b/ash/accelerators/accelerator_table.cc index a3303f6..c6c484a 100644 --- a/ash/accelerators/accelerator_table.cc +++ b/ash/accelerators/accelerator_table.cc @@ -127,9 +127,6 @@ const AcceleratorData kAcceleratorData[] = { { true, ui::VKEY_F14, ui::EF_NONE, SHOW_KEYBOARD_OVERLAY }, { true, ui::VKEY_N, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, SHOW_MESSAGE_CENTER_BUBBLE }, - { true, ui::VKEY_BROWSER_BACK, - ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, - SHOW_OAK }, { true, ui::VKEY_S, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, SHOW_SYSTEM_TRAY_BUBBLE }, { true, ui::VKEY_ESCAPE, ui::EF_SHIFT_DOWN, SHOW_TASK_MANAGER }, diff --git a/ash/accelerators/accelerator_table.h b/ash/accelerators/accelerator_table.h index d120960..2c88bfc 100644 --- a/ash/accelerators/accelerator_table.h +++ b/ash/accelerators/accelerator_table.h @@ -100,7 +100,6 @@ enum AcceleratorAction { SCALE_UI_UP, SHOW_KEYBOARD_OVERLAY, SHOW_MESSAGE_CENTER_BUBBLE, - SHOW_OAK, SHOW_SYSTEM_TRAY_BUBBLE, SHOW_TASK_MANAGER, SILENCE_SPOKEN_FEEDBACK, diff --git a/ash/ash.gyp b/ash/ash.gyp index be8fc8c..10c10a6 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -34,7 +34,6 @@ '../ui/gfx/gfx.gyp:gfx_geometry', '../ui/keyboard/keyboard.gyp:keyboard', '../ui/message_center/message_center.gyp:message_center', - '../ui/oak/oak.gyp:oak', '../ui/resources/ui_resources.gyp:ui_resources', '../ui/ui.gyp:ui', '../ui/views/controls/webview/webview.gyp:webview', diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc index 26c6693..d4a4899 100644 --- a/ash/ash_switches.cc +++ b/ash/ash_switches.cc @@ -127,9 +127,6 @@ const char kAshEnableMagnifierKeyScroller[] = const char kAshEnableMultiUserTray[] = "ash-enable-multi-user-tray"; #endif -// Enables the Oak tree viewer. -const char kAshEnableOak[] = "ash-enable-oak"; - // Enables software based mirroring. const char kAshEnableSoftwareMirroring[] = "ash-enable-software-mirroring"; diff --git a/ash/ash_switches.h b/ash/ash_switches.h index 96328e4f..15e81df 100644 --- a/ash/ash_switches.h +++ b/ash/ash_switches.h @@ -52,7 +52,6 @@ ASH_EXPORT extern const char kAshEnableMemoryMonitor[]; ASH_EXPORT extern const char kAshEnableMagnifierKeyScroller[]; ASH_EXPORT extern const char kAshEnableMultiUserTray[]; #endif -ASH_EXPORT extern const char kAshEnableOak[]; ASH_EXPORT extern const char kAshEnableSoftwareMirroring[]; ASH_EXPORT extern const char kAshEnableSystemSounds[]; ASH_EXPORT extern const char kAshEnableTrayDragging[]; diff --git a/build/all.gyp b/build/all.gyp index ed58b9e..dbcac8c 100644 --- a/build/all.gyp +++ b/build/all.gyp @@ -208,7 +208,6 @@ ['use_aura==1', { 'dependencies': [ '../ui/aura/aura.gyp:*', - '../ui/oak/oak.gyp:*', ], }], ['use_ash==1', { diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 4b86d65..9d4b249 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -6414,12 +6414,6 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_FLAGS_NTP_OTHER_SESSIONS_MENU_DESCRIPTION" desc="Description for the flag to disable the 'Other devices' menu on the NTP."> Disable the new tab page menu for accessing tabs on other devices. </message> - <message name="IDS_FLAGS_ENABLE_ASH_OAK_NAME" desc="Name of the flag to enable the oak tree viewer in ash."> - Enable Oak. - </message> - <message name="IDS_FLAGS_ENABLE_ASH_OAK_DESCRIPTION" desc="Description of the flag to enable the oak tree viewer in ash."> - Enables the Oak tree viewer in ash. Allows inspection of window, layer and view hierarchies and their properties. Press Ctrl+Shift+F1 to access. - </message> <message name="IDS_FLAGS_ENABLE_DEVTOOLS_EXPERIMENTS_NAME" desc="Name for the flag to enable experiments in Developer Tools"> Enable Developer Tools experiments. </message> diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index da3442f..26d917c 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -917,15 +917,6 @@ const Experiment kExperiments[] = { kOsDesktop, SINGLE_VALUE_TYPE(switches::kDisableNTPOtherSessionsMenu) }, -#if defined(USE_ASH) - { - "enable-ash-oak", - IDS_FLAGS_ENABLE_ASH_OAK_NAME, - IDS_FLAGS_ENABLE_ASH_OAK_DESCRIPTION, - kOsAll, - SINGLE_VALUE_TYPE(ash::switches::kAshEnableOak), - }, -#endif { "enable-devtools-experiments", IDS_FLAGS_ENABLE_DEVTOOLS_EXPERIMENTS_NAME, diff --git a/ui/oak/DEPS b/ui/oak/DEPS deleted file mode 100644 index fd0f304..0000000 --- a/ui/oak/DEPS +++ /dev/null @@ -1,8 +0,0 @@ -include_rules = [ - "+grit/ui_resources.h", - "+skia/ext", - "+ui/aura", - "+ui/base", - "+ui/gfx", - "+ui/views", -] diff --git a/ui/oak/oak.gyp b/ui/oak/oak.gyp deleted file mode 100644 index 750b3ef..0000000 --- a/ui/oak/oak.gyp +++ /dev/null @@ -1,49 +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. - -{ - 'variables': { - 'chromium_code': 1, - }, - - 'targets': [ - { - 'target_name': 'oak', - 'type': '<(component)', - 'dependencies': [ - '../../base/base.gyp:base', - '../../base/base.gyp:base_i18n', - '../../skia/skia.gyp:skia', - '../../url/url.gyp:url_lib', - '../aura/aura.gyp:aura', - '../compositor/compositor.gyp:compositor', - '../events/events.gyp:events', - '../gfx/gfx.gyp:gfx', - '../gfx/gfx.gyp:gfx_geometry', - '../resources/ui_resources.gyp:ui_resources', - '../ui.gyp:ui', - '../views/views.gyp:views', - ], - 'defines': [ - 'OAK_IMPLEMENTATION', - ], - 'sources': [ - # All .cc, .h under oak, except unittests - 'oak.h', - 'oak_aura_window_display.cc', - 'oak_aura_window_display.h', - 'oak_export.h', - 'oak_pretty_print.cc', - 'oak_pretty_print.h', - 'oak_tree_model.cc', - 'oak_tree_model.h', - 'oak_window.cc', - 'oak_window.h', - 'oak_details_model.h', - ], - # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. - 'msvs_disabled_warnings': [ 4267, ], - }, - ], -} diff --git a/ui/oak/oak.h b/ui/oak/oak.h deleted file mode 100644 index 0ffdc85..0000000 --- a/ui/oak/oak.h +++ /dev/null @@ -1,17 +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_OAK_OAK_H_ -#define UI_OAK_OAK_H_ - -#include "ui/oak/oak_export.h" - -namespace oak { - -// Shows the Oak window. Refocuses an existing one. -OAK_EXPORT void ShowOakWindowWithContext(gfx::NativeView context); - -} // namespace oak - -#endif // UI_OAK_OAK_H_ diff --git a/ui/oak/oak_aura_window_display.cc b/ui/oak/oak_aura_window_display.cc deleted file mode 100644 index 0bfe88f..0000000 --- a/ui/oak/oak_aura_window_display.cc +++ /dev/null @@ -1,162 +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/oak/oak_aura_window_display.h" - -#include "base/logging.h" -#include "base/strings/string_util.h" -#include "base/strings/stringprintf.h" -#include "base/strings/utf_string_conversions.h" -#include "ui/aura/window.h" -#include "ui/base/models/table_model_observer.h" -#include "ui/oak/oak_pretty_print.h" -#include "ui/views/corewm/window_util.h" - -namespace oak { -namespace internal { -namespace { -enum { -ROW_ID = 0, -ROW_DELEGATE, -ROW_TYPE, -ROW_NAME, -ROW_TITLE, -ROW_TRANSPARENT, -ROW_LAYER, -ROW_VISIBLE, -ROW_BOUNDS, -ROW_BOUNDSINROOTWINDOW, -ROW_TRANSFORM, -ROW_PARENT, -ROW_ROOTWINDOW, -ROW_TRANSIENTCHILDREN, -ROW_TRANSIENTPARENT, -ROW_USERDATA, -ROW_IGNOREEVENTS, -ROW_CANFOCUS, -ROW_HITTESTBOUNDSOVERRIDEINNER, -ROW_COUNT -}; - -// aura::Window-specific pretty printing. -base::string16 PropertyWithWindowType(int type) { - std::string property = "Type: "; - switch (type) { - case ui::wm::WINDOW_TYPE_UNKNOWN: - property.append("WINDOW_TYPE_UNKNOWN"); - break; - case ui::wm::WINDOW_TYPE_NORMAL: - property.append("WINDOW_TYPE_NORMAL"); - break; - case ui::wm::WINDOW_TYPE_POPUP: - property.append("WINDOW_TYPE_POPUP"); - break; - case ui::wm::WINDOW_TYPE_CONTROL: - property.append("WINDOW_TYPE_CONTROL"); - break; - case ui::wm::WINDOW_TYPE_PANEL: - property.append("WINDOW_TYPE_PANEL"); - break; - case ui::wm::WINDOW_TYPE_MENU: - property.append("WINDOW_TYPE_MENU"); - break; - case ui::wm::WINDOW_TYPE_TOOLTIP: - property.append("WINDOW_TYPE_TOOLTIP"); - break; - default: - NOTREACHED(); - break; - } - return base::ASCIIToUTF16(property); -} - -} // namespace - -//////////////////////////////////////////////////////////////////////////////// -// OakAuraWindowDisplay, public: - -OakAuraWindowDisplay::OakAuraWindowDisplay() : observer_(NULL), window_(NULL) { -} - -OakAuraWindowDisplay::~OakAuraWindowDisplay() { -} - -//////////////////////////////////////////////////////////////////////////////// -// OakAuraWindowDisplay, OakDetailsModel overrides: - -void OakAuraWindowDisplay::SetValue(aura::Window* window) { - window_ = window; - observer_->OnModelChanged(); -} - -//////////////////////////////////////////////////////////////////////////////// -// OakAuraWindowDisplay, ui::TableModel implementation: - -int OakAuraWindowDisplay::RowCount() { - return ROW_COUNT; -} - -base::string16 OakAuraWindowDisplay::GetText(int row, int column_id) { - if (!window_) - return base::string16(); - - base::string16 text; - switch (row) { - case ROW_ID: - return PropertyWithInteger("Id: ", window_->id()); - case ROW_DELEGATE: - return PropertyWithVoidStar("Delegate: ", window_->delegate()); - case ROW_TYPE: - return PropertyWithWindowType(window_->type()); - case ROW_NAME: - return base::ASCIIToUTF16("Name: " + window_->name()); - case ROW_TITLE: - return base::ASCIIToUTF16("Title: ") + window_->title(); - case ROW_TRANSPARENT: - return PropertyWithBool("Transparent: ", window_->transparent()); - case ROW_LAYER: - return PropertyWithVoidStar("Layer: ", window_->layer()); - case ROW_VISIBLE: - return PropertyWithBool("Visible: ", window_->IsVisible()); - case ROW_BOUNDS: - return PropertyWithBounds("Bounds: ", window_->bounds()); - case ROW_BOUNDSINROOTWINDOW: - return PropertyWithBounds("Bounds in Root Window: ", - window_->GetBoundsInRootWindow()); - case ROW_TRANSFORM: - return base::ASCIIToUTF16("Transform:"); - case ROW_PARENT: - return PropertyWithVoidStar("Parent: ", window_->parent()); - case ROW_ROOTWINDOW: - return PropertyWithVoidStar("Root Window: ", window_->GetRootWindow()); - case ROW_TRANSIENTCHILDREN: - return PropertyWithInteger( - "Transient Children: ", - views::corewm::GetTransientChildren(window_).size()); - case ROW_TRANSIENTPARENT: - return PropertyWithVoidStar("Transient Parent: ", - views::corewm::GetTransientParent(window_)); - case ROW_USERDATA: - return PropertyWithVoidStar("User Data: ", window_->user_data()); - case ROW_IGNOREEVENTS: - return PropertyWithBool("Can receive events: ", - window_->CanReceiveEvents()); - case ROW_CANFOCUS: - return PropertyWithBool("Can Focus: ", window_->CanFocus()); - case ROW_HITTESTBOUNDSOVERRIDEINNER: - return PropertyWithInsets("Hit test bounds override inner: ", - window_->hit_test_bounds_override_inner()); - default: - NOTREACHED(); - break; - } - return base::string16(); -} - -void OakAuraWindowDisplay::SetObserver(ui::TableModelObserver* observer) { - observer_ = observer; -} - -} // namespace internal -} // namespace oak diff --git a/ui/oak/oak_aura_window_display.h b/ui/oak/oak_aura_window_display.h deleted file mode 100644 index cc78c86..0000000 --- a/ui/oak/oak_aura_window_display.h +++ /dev/null @@ -1,37 +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_OAK_OAK_AURA_WINDOW_DISPLAY_H_ -#define UI_OAK_OAK_AURA_WINDOW_DISPLAY_H_ - -#include "base/compiler_specific.h" -#include "ui/oak/oak_details_model.h" - -namespace oak { -namespace internal { - -class OakAuraWindowDisplay : public OakDetailsModel { - public: - OakAuraWindowDisplay(); - virtual ~OakAuraWindowDisplay(); - - private: - // Overridden from OakDetailsModel: - virtual void SetValue(aura::Window* window) OVERRIDE; - - // Overridden from ui::TableModel: - virtual int RowCount() OVERRIDE; - virtual base::string16 GetText(int row, int column_id) OVERRIDE; - virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE; - - ui::TableModelObserver* observer_; - aura::Window* window_; - - DISALLOW_COPY_AND_ASSIGN(OakAuraWindowDisplay); -}; - -} // namespace internal -} // namespace oak - -#endif // UI_OAK_OAK_AURA_WINDOW_DISPLAY_H_ diff --git a/ui/oak/oak_details_model.h b/ui/oak/oak_details_model.h deleted file mode 100644 index eb558aa..0000000 --- a/ui/oak/oak_details_model.h +++ /dev/null @@ -1,33 +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_OAK_OAK_DETAILS_MODEL_H_ -#define UI_OAK_OAK_DETAILS_MODEL_H_ - -#include "ui/base/models/table_model.h" - -namespace aura { -class Window; -} - -namespace oak { -namespace internal { - -class OakDetailsModel : public ui::TableModel { - public: - virtual ~OakDetailsModel() {} - - virtual void SetValue(aura::Window* window) = 0; - - protected: - OakDetailsModel() {} - - private: - DISALLOW_COPY_AND_ASSIGN(OakDetailsModel); -}; - -} // namespace internal -} // namespace oak - -#endif // UI_OAK_OAK_DETAILS_MODEL_H_ diff --git a/ui/oak/oak_export.h b/ui/oak/oak_export.h deleted file mode 100644 index 726366c..0000000 --- a/ui/oak/oak_export.h +++ /dev/null @@ -1,32 +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_OAK_OAK_EXPORT_H_ -#define UI_OAK_OAK_EXPORT_H_ - -// Defines AURA_EXPORT so that functionality implemented by the aura module -// can be exported to consumers. - -#if defined(COMPONENT_BUILD) -#if defined(WIN32) - -#if defined(OAK_IMPLEMENTATION) -#define OAK_EXPORT __declspec(dllexport) -#else -#define OAK_EXPORT __declspec(dllimport) -#endif // defined(OAK_IMPLEMENTATION) - -#else // defined(WIN32) -#if defined(OAK_IMPLEMENTATION) -#define OAK_EXPORT __attribute__((visibility("default"))) -#else -#define OAK_EXPORT -#endif -#endif - -#else // defined(COMPONENT_BUILD) -#define OAK_EXPORT -#endif - -#endif // UI_OAK_OAK_EXPORT_H_ diff --git a/ui/oak/oak_pretty_print.cc b/ui/oak/oak_pretty_print.cc deleted file mode 100644 index dcde03d..0000000 --- a/ui/oak/oak_pretty_print.cc +++ /dev/null @@ -1,43 +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/oak/oak_pretty_print.h" - -#include "base/strings/string_number_conversions.h" -#include "base/strings/string_util.h" -#include "base/strings/stringprintf.h" -#include "base/strings/utf_string_conversions.h" -#include "ui/gfx/insets.h" -#include "ui/gfx/rect.h" - -namespace oak { -namespace internal { - -base::string16 PropertyWithInteger(const std::string& prefix, int value) { - return base::ASCIIToUTF16(prefix) + base::IntToString16(value); -} - -base::string16 PropertyWithVoidStar(const std::string& prefix, void* ptr) { - unsigned int cast_ptr = - static_cast<unsigned int>(reinterpret_cast<intptr_t>(ptr)); - return base::ASCIIToUTF16( - prefix + "0x" + (ptr ? base::StringPrintf("%x", cast_ptr) : "0")); -} - -base::string16 PropertyWithBool(const std::string& prefix, bool value) { - return base::ASCIIToUTF16(prefix + (value ? "true" : "false")); -} - -base::string16 PropertyWithBounds(const std::string& prefix, - const gfx::Rect& bounds) { - return base::ASCIIToUTF16(prefix + bounds.ToString()); -} - -base::string16 PropertyWithInsets(const std::string& prefix, - const gfx::Insets& insets) { - return base::ASCIIToUTF16(prefix + insets.ToString()); -} - -} // namespace internal -} // namespace oak diff --git a/ui/oak/oak_pretty_print.h b/ui/oak/oak_pretty_print.h deleted file mode 100644 index ee294aa..0000000 --- a/ui/oak/oak_pretty_print.h +++ /dev/null @@ -1,31 +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_OAK_OAK_PRETTY_PRINT_H_ -#define UI_OAK_OAK_PRETTY_PRINT_H_ - -#include "base/strings/string16.h" - -namespace gfx { -class Insets; -class Rect; -} - -namespace oak { -namespace internal { - -// Functions that return a string consisting of a prefix and the supplied value -// converted to a pretty string representation. -base::string16 PropertyWithInteger(const std::string& prefix, int value); -base::string16 PropertyWithVoidStar(const std::string& prefix, void* ptr); -base::string16 PropertyWithBool(const std::string& prefix, bool value); -base::string16 PropertyWithBounds(const std::string& prefix, - const gfx::Rect& bounds); -base::string16 PropertyWithInsets(const std::string& prefix, - const gfx::Insets& insets); - -} // namespace internal -} // namespace oak - -#endif // UI_OAK_OAK_PRETTY_PRINT_H_ diff --git a/ui/oak/oak_tree_model.cc b/ui/oak/oak_tree_model.cc deleted file mode 100644 index c5247c3..0000000 --- a/ui/oak/oak_tree_model.cc +++ /dev/null @@ -1,39 +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/oak/oak_tree_model.h" - -#include "base/strings/utf_string_conversions.h" -#include "ui/aura/root_window.h" -#include "ui/aura/window.h" -#include "ui/base/models/tree_node_model.h" - -namespace oak { -namespace internal { - -base::string16 GetNodeTitleForWindow(aura::Window* window) { - std::string window_name = window->name(); - if (window_name.empty()) - window_name.append("Unnamed window"); - return base::ASCIIToUTF16(window_name); -} - -void AddChildWindows(aura::Window* parent_window, WindowNode* parent_node) { - aura::Window::Windows::const_iterator it = parent_window->children().begin(); - for (; it != parent_window->children().end(); ++it) { - WindowNode* child_node = new WindowNode(GetNodeTitleForWindow(*it), *it); - parent_node->Add(child_node, parent_node->child_count()); - AddChildWindows(*it, child_node); - } -} - -TreeOfWindows* GenerateModel(aura::Window* root) { - WindowNode* root_node = new WindowNode(GetNodeTitleForWindow(root), root); - TreeOfWindows* tree = new TreeOfWindows(root_node); - AddChildWindows(root, root_node); - return tree; -} - -} // namespace internal -} // namespace oak diff --git a/ui/oak/oak_tree_model.h b/ui/oak/oak_tree_model.h deleted file mode 100644 index f68912d..0000000 --- a/ui/oak/oak_tree_model.h +++ /dev/null @@ -1,26 +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_OAK_OAK_TREE_MODEL_H_ -#define UI_OAK_OAK_TREE_MODEL_H_ - -#include "base/compiler_specific.h" -#include "ui/base/models/tree_node_model.h" - -namespace aura { -class Window; -} - -namespace oak { -namespace internal { - -typedef ui::TreeNodeWithValue<aura::Window*> WindowNode; -typedef ui::TreeNodeModel<WindowNode> TreeOfWindows; - -TreeOfWindows* GenerateModel(aura::Window* root); - -} // namespace internal -} // namespace oak - -#endif // UI_OAK_OAK_TREE_MODEL_H_ diff --git a/ui/oak/oak_window.cc b/ui/oak/oak_window.cc deleted file mode 100644 index 5ef6b02..0000000 --- a/ui/oak/oak_window.cc +++ /dev/null @@ -1,159 +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/oak/oak_window.h" - -#include "base/strings/utf_string_conversions.h" -#include "grit/ui_resources.h" -#include "ui/aura/root_window.h" -#include "ui/aura/window.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/gfx/canvas.h" -#include "ui/gfx/image/image.h" -#include "ui/oak/oak.h" -#include "ui/oak/oak_aura_window_display.h" -#include "ui/views/controls/table/table_view.h" -#include "ui/views/controls/tree/tree_view.h" -#include "ui/views/layout/layout_constants.h" -#include "ui/views/widget/widget.h" - -namespace oak { -namespace internal { -namespace { -const SkColor kBorderColor = SkColorSetRGB(0xCC, 0xCC, 0xCC); -} // namespace - -// static -views::Widget* OakWindow::instance = NULL; - -//////////////////////////////////////////////////////////////////////////////// -// OakWindow, public: - -OakWindow::OakWindow() : tree_container_(NULL) {} - -OakWindow::~OakWindow() { - // The tree/table need to be destroyed before the model. - tree_.reset(); - details_.reset(); -} - -//////////////////////////////////////////////////////////////////////////////// -// OakWindow, views::WidgetDelegateView implementation: - -bool OakWindow::CanResize() const { - return true; -} - -bool OakWindow::CanMaximize() const { - return true; -} - -base::string16 OakWindow::GetWindowTitle() const { - return base::ASCIIToUTF16("Oak"); -} - -views::View* OakWindow::GetContentsView() { - return this; -} - -gfx::ImageSkia OakWindow::GetWindowIcon() { - ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - return *rb.GetImageNamed(IDR_OAK).ToImageSkia(); -} - -bool OakWindow::ShouldShowWindowIcon() const { - return true; -} - -void OakWindow::DeleteDelegate() { - instance = NULL; - delete this; -} - -//////////////////////////////////////////////////////////////////////////////// -// OakWindow, views::View overrides: - -void OakWindow::OnPaint(gfx::Canvas* canvas) { - canvas->DrawColor(SK_ColorWHITE); - canvas->FillRect(separator_rect_, kBorderColor); -} - -void OakWindow::ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) { - if (details.is_add && details.child == this) - Init(); -} - -void OakWindow::Layout() { - gfx::Rect content_bounds = GetLocalBounds(); - content_bounds.Inset(views::kPanelHorizMargin, views::kPanelVertMargin); - - int tree_height = - (content_bounds.height() / 2) - views::kUnrelatedControlVerticalSpacing; - gfx::Rect tree_bounds = content_bounds; - tree_bounds.set_height(tree_height); - tree_container_->SetBoundsRect(tree_bounds); - - separator_rect_ = content_bounds; - separator_rect_.set_y( - tree_bounds.bottom() + views::kRelatedControlVerticalSpacing); - separator_rect_.set_height(1); - - gfx::Rect details_bounds = content_bounds; - details_bounds.set_y( - separator_rect_.bottom() + views::kRelatedControlVerticalSpacing); - details_bounds.set_height(content_bounds.bottom() - details_bounds.y()); - details_container_->SetBoundsRect(details_bounds); -} - -//////////////////////////////////////////////////////////////////////////////// -// OakWindow, views::TreeViewController implementation: - -void OakWindow::OnTreeViewSelectionChanged(views::TreeView* tree) { - details_model_->SetValue(tree_model_->AsNode(tree->GetSelectedNode())->value); -} - -//////////////////////////////////////////////////////////////////////////////// -// OakWindow, private: - -void OakWindow::Init() { - tree_model_.reset( - GenerateModel(GetWidget()->GetNativeView()->GetRootWindow())); - tree_.reset(new views::TreeView); - tree_->set_owned_by_client(); - tree_->SetController(this); - tree_->SetModel(tree_model_.get()); - tree_container_ = tree_->CreateParentIfNecessary(); - AddChildView(tree_container_); - - details_model_.reset(new OakAuraWindowDisplay); - std::vector<ui::TableColumn> columns; - columns.push_back(ui::TableColumn()); - details_.reset(new views::TableView(details_model_.get(), - columns, - views::TEXT_ONLY, - true)); - details_->set_owned_by_client(); - details_container_ = details_->CreateParentIfNecessary(); - details_->SetModel(details_model_.get()); - AddChildView(details_container_); - - OnTreeViewSelectionChanged(tree_.get()); -} - -} // namespace internal - -void ShowOakWindowWithContext(gfx::NativeView context) { - if (!internal::OakWindow::instance) { - // TODO(erg): Do we want to reuse this window in times with a different - // context? For now, this is OK, but if we ever use Oak outside of the ash - // shell, we run into crbug.com/165759. - internal::OakWindow::instance = - views::Widget::CreateWindowWithContextAndBounds( - new internal::OakWindow, context, gfx::Rect(10, 10, 500, 500)); - } - internal::OakWindow::instance->Show(); -} - -} // namespace oak diff --git a/ui/oak/oak_window.h b/ui/oak/oak_window.h deleted file mode 100644 index 087334e..0000000 --- a/ui/oak/oak_window.h +++ /dev/null @@ -1,67 +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_OAK_OAK_WINDOW_H_ -#define UI_OAK_OAK_WINDOW_H_ - -#include "ui/oak/oak_tree_model.h" -#include "ui/views/controls/tree/tree_view_controller.h" -#include "ui/views/widget/widget_delegate.h" - -namespace views { -class TableView; -} - -namespace oak { -namespace internal { - -class OakTreeModel; -class OakDetailsModel; - -class OakWindow : public views::WidgetDelegateView, - public views::TreeViewController { - public: - OakWindow(); - virtual ~OakWindow(); - - static views::Widget* instance; - - // Overridden from views::WidgetDelegateView: - virtual bool CanResize() const OVERRIDE; - virtual bool CanMaximize() const OVERRIDE; - virtual base::string16 GetWindowTitle() const OVERRIDE; - virtual views::View* GetContentsView() OVERRIDE; - virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; - virtual bool ShouldShowWindowIcon() const OVERRIDE; - virtual void DeleteDelegate() OVERRIDE; - - private: - // Overridden from views::View: - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE; - virtual void Layout() OVERRIDE; - - // Overridden from views::TreeViewController: - virtual void OnTreeViewSelectionChanged(views::TreeView* tree) OVERRIDE; - - void Init(); - - scoped_ptr<views::TreeView> tree_; - scoped_ptr<TreeOfWindows> tree_model_; - views::View* tree_container_; - - gfx::Rect separator_rect_; - - scoped_ptr<views::TableView> details_; - scoped_ptr<OakDetailsModel> details_model_; - views::View* details_container_; - - DISALLOW_COPY_AND_ASSIGN(OakWindow); -}; - -} // namespace internal -} // namespace oak - -#endif // UI_OAK_OAK_WINDOW_H_ |