diff options
-rw-r--r-- | chrome/browser/chromeos/dom_ui/menu_ui.cc | 36 | ||||
-rw-r--r-- | chrome/browser/chromeos/dom_ui/menu_ui.h | 8 | ||||
-rw-r--r-- | chrome/browser/chromeos/dom_ui/network_menu_ui.cc | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/dom_ui/wrench_menu_ui.cc | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/views/menu_locator.cc | 30 | ||||
-rw-r--r-- | chrome/browser/chromeos/views/menu_locator.h | 10 | ||||
-rw-r--r-- | chrome/browser/chromeos/views/native_menu_domui.cc | 12 | ||||
-rw-r--r-- | chrome/browser/chromeos/views/native_menu_domui.h | 16 | ||||
-rw-r--r-- | chrome/browser/chromeos/views/webui_menu_widget.cc (renamed from chrome/browser/chromeos/views/domui_menu_widget.cc) | 52 | ||||
-rw-r--r-- | chrome/browser/chromeos/views/webui_menu_widget.h (renamed from chrome/browser/chromeos/views/domui_menu_widget.h) | 22 | ||||
-rw-r--r-- | chrome/browser/chromeos/webui_menu_control.h (renamed from chrome/browser/chromeos/dom_ui/domui_menu_control.h) | 18 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 6 |
12 files changed, 111 insertions, 111 deletions
diff --git a/chrome/browser/chromeos/dom_ui/menu_ui.cc b/chrome/browser/chromeos/dom_ui/menu_ui.cc index a12c8c3..e52fb58 100644 --- a/chrome/browser/chromeos/dom_ui/menu_ui.cc +++ b/chrome/browser/chromeos/dom_ui/menu_ui.cc @@ -17,8 +17,8 @@ #include "base/values.h" #include "base/weak_ptr.h" #include "chrome/browser/browser_thread.h" -#include "chrome/browser/chromeos/views/domui_menu_widget.h" #include "chrome/browser/chromeos/views/native_menu_domui.h" +#include "chrome/browser/chromeos/views/webui_menu_widget.h" #include "chrome/browser/dom_ui/web_ui_util.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_delegate.h" @@ -403,7 +403,7 @@ void MenuHandler::HandleActivate(const ListValue* values) { int index; success = base::StringToInt(index_str, &index); DCHECK(success); - chromeos::DOMUIMenuControl* control = GetMenuControl(); + chromeos::WebUIMenuControl* control = GetMenuControl(); if (control) { ui::MenuModel* model = GetMenuModel(); DCHECK(model); @@ -414,8 +414,8 @@ void MenuHandler::HandleActivate(const ListValue* values) { control->Activate(model, index, activation == "close_and_activate" ? - chromeos::DOMUIMenuControl::CLOSE_AND_ACTIVATE : - chromeos::DOMUIMenuControl::ACTIVATE_NO_CLOSE); + chromeos::WebUIMenuControl::CLOSE_AND_ACTIVATE : + chromeos::WebUIMenuControl::ACTIVATE_NO_CLOSE); } } } @@ -434,31 +434,31 @@ void MenuHandler::HandleOpenSubmenu(const ListValue* values) { int y; success = base::StringToInt(y_str, &y); DCHECK(success); - chromeos::DOMUIMenuControl* control = GetMenuControl(); + chromeos::WebUIMenuControl* control = GetMenuControl(); if (control) control->OpenSubmenu(index, y); } void MenuHandler::HandleCloseSubmenu(const ListValue* values) { - chromeos::DOMUIMenuControl* control = GetMenuControl(); + chromeos::WebUIMenuControl* control = GetMenuControl(); if (control) control->CloseSubmenu(); } void MenuHandler::HandleMoveInputToSubmenu(const ListValue* values) { - chromeos::DOMUIMenuControl* control = GetMenuControl(); + chromeos::WebUIMenuControl* control = GetMenuControl(); if (control) control->MoveInputToSubmenu(); } void MenuHandler::HandleMoveInputToParent(const ListValue* values) { - chromeos::DOMUIMenuControl* control = GetMenuControl(); + chromeos::WebUIMenuControl* control = GetMenuControl(); if (control) control->MoveInputToParent(); } void MenuHandler::HandleCloseAll(const ListValue* values) { - chromeos::DOMUIMenuControl* control = GetMenuControl(); + chromeos::WebUIMenuControl* control = GetMenuControl(); if (control) control->CloseAll(); } @@ -480,13 +480,13 @@ void MenuHandler::HandleLog(const ListValue* values) { void MenuHandler::UpdatePreferredSize(const gfx::Size& new_size) { if (!loaded_) return; - chromeos::DOMUIMenuControl* control = GetMenuControl(); + chromeos::WebUIMenuControl* control = GetMenuControl(); if (control) control->SetSize(new_size); } void MenuHandler::LoadingStateChanged(TabContents* contents) { - chromeos::DOMUIMenuControl* control = GetMenuControl(); + chromeos::WebUIMenuControl* control = GetMenuControl(); if (control && !contents->is_loading()) { loaded_ = true; control->OnLoad(); @@ -504,18 +504,18 @@ namespace chromeos { // //////////////////////////////////////////////////////////////////////////////// -chromeos::DOMUIMenuControl* MenuHandlerBase::GetMenuControl() { - DOMUIMenuWidget* widget = - chromeos::DOMUIMenuWidget::FindDOMUIMenuWidget( +chromeos::WebUIMenuControl* MenuHandlerBase::GetMenuControl() { + WebUIMenuWidget* widget = + chromeos::WebUIMenuWidget::FindWebUIMenuWidget( dom_ui_->tab_contents()->GetNativeView()); if (widget) - return widget->domui_menu(); // NativeMenuDOMUI implements DOMUIMenuControl + return widget->domui_menu(); // NativeMenuDOMUI implements WebUIMenuControl else return NULL; } ui::MenuModel* MenuHandlerBase::GetMenuModel() { - DOMUIMenuControl* control = GetMenuControl(); + WebUIMenuControl* control = GetMenuControl(); if (control) return control->GetMenuModel(); else @@ -593,8 +593,8 @@ void MenuUI::ModelUpdated(const ui::MenuModel* model) { } items->Set(index, item); } - DOMUIMenuWidget* widget = - chromeos::DOMUIMenuWidget::FindDOMUIMenuWidget( + WebUIMenuWidget* widget = + chromeos::WebUIMenuWidget::FindWebUIMenuWidget( tab_contents()->GetNativeView()); DCHECK(widget); json_model.SetInteger("maxIconWidth", max_icon_width); diff --git a/chrome/browser/chromeos/dom_ui/menu_ui.h b/chrome/browser/chromeos/dom_ui/menu_ui.h index dd3c85a..0277f3a 100644 --- a/chrome/browser/chromeos/dom_ui/menu_ui.h +++ b/chrome/browser/chromeos/dom_ui/menu_ui.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -19,7 +19,7 @@ class MenuModel; namespace chromeos { -class DOMUIMenuControl; +class WebUIMenuControl; // MenuSourceDelegate class allows subclass to injects specific values // to menu javascript code. @@ -27,7 +27,7 @@ class MenuSourceDelegate { public: virtual ~MenuSourceDelegate() {} // Subclass can add extra parameters or replaces default configuration. - virtual void AddCustomConfigValues(DictionaryValue* config) const {}; + virtual void AddCustomConfigValues(DictionaryValue* config) const {} // Subclass can add their values to |localized_strings| and those values // are used by JS template builder and could be accessed via JS class @@ -82,7 +82,7 @@ class MenuHandlerBase : public DOMMessageHandler { // Returns the menu control that is associated with the // MenuUI. This may return null when menu is being deleted. - DOMUIMenuControl* GetMenuControl(); + WebUIMenuControl* GetMenuControl(); // Returns the menu model for this menu ui. // This may return null when menu is being deleted. diff --git a/chrome/browser/chromeos/dom_ui/network_menu_ui.cc b/chrome/browser/chromeos/dom_ui/network_menu_ui.cc index ec8a567..7140dcb 100644 --- a/chrome/browser/chromeos/dom_ui/network_menu_ui.cc +++ b/chrome/browser/chromeos/dom_ui/network_menu_ui.cc @@ -10,8 +10,8 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/chromeos/status/network_menu.h" -#include "chrome/browser/chromeos/views/domui_menu_widget.h" #include "chrome/browser/chromeos/views/native_menu_domui.h" +#include "chrome/browser/chromeos/views/webui_menu_widget.h" #include "chrome/browser/dom_ui/web_ui_theme_source.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/url_constants.h" @@ -76,8 +76,8 @@ void NetworkMenuHandler::HandleAction(const ListValue* values) { static_cast<chromeos::NetworkMenuUI*>(dom_ui_); bool close_menu = network_menu_ui->ModelAction(model, values); if (close_menu) { - chromeos::DOMUIMenuWidget* widget - = chromeos::DOMUIMenuWidget::FindDOMUIMenuWidget( + chromeos::WebUIMenuWidget* widget + = chromeos::WebUIMenuWidget::FindWebUIMenuWidget( dom_ui_->tab_contents()->GetNativeView()); if (widget) { chromeos::NativeMenuDOMUI* domui_menu = widget->domui_menu(); diff --git a/chrome/browser/chromeos/dom_ui/wrench_menu_ui.cc b/chrome/browser/chromeos/dom_ui/wrench_menu_ui.cc index 2b98d37..9a1c35c 100644 --- a/chrome/browser/chromeos/dom_ui/wrench_menu_ui.cc +++ b/chrome/browser/chromeos/dom_ui/wrench_menu_ui.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -11,8 +11,8 @@ #include "base/weak_ptr.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/browser_list.h" -#include "chrome/browser/chromeos/views/domui_menu_widget.h" #include "chrome/browser/chromeos/views/native_menu_domui.h" +#include "chrome/browser/chromeos/views/webui_menu_widget.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/notification_registrar.h" @@ -82,7 +82,7 @@ void WrenchMenuUI::Observe(NotificationType type, } void WrenchMenuUI::UpdateZoomControls() { - DOMUIMenuWidget* widget = DOMUIMenuWidget::FindDOMUIMenuWidget( + WebUIMenuWidget* widget = WebUIMenuWidget::FindWebUIMenuWidget( tab_contents()->GetNativeView()); if (!widget || !widget->is_root()) return; diff --git a/chrome/browser/chromeos/views/menu_locator.cc b/chrome/browser/chromeos/views/menu_locator.cc index 779ce76..6dc8148 100644 --- a/chrome/browser/chromeos/views/menu_locator.cc +++ b/chrome/browser/chromeos/views/menu_locator.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -6,7 +6,7 @@ #include "base/i18n/rtl.h" #include "base/logging.h" -#include "chrome/browser/chromeos/views/domui_menu_widget.h" +#include "chrome/browser/chromeos/views/webui_menu_widget.h" #include "gfx/point.h" #include "gfx/rect.h" #include "gfx/insets.h" @@ -15,7 +15,7 @@ namespace { -using chromeos::DOMUIMenuWidget; +using chromeos::WebUIMenuWidget; // Menu's corner radious. const int kMenuCornerRadius = 0; // crosbug.com/7718. @@ -33,8 +33,8 @@ gfx::Rect GetScreenRectAt(int x, int y) { } // Returns adjusted height of the menu that fits to the screen's -// hight, and enables scrolling if necessary. -int AdjustHeight(DOMUIMenuWidget* widget, +// height, and enables scrolling if necessary. +int AdjustHeight(WebUIMenuWidget* widget, int screen_height, int height) { // TODO(oshima): Locator needs a preferred size so that @@ -52,7 +52,7 @@ int AdjustHeight(DOMUIMenuWidget* widget, } // Updates the root menu's bounds to fit to the screen. -void UpdateRootMenuBounds(DOMUIMenuWidget* widget, +void UpdateRootMenuBounds(WebUIMenuWidget* widget, const gfx::Point& origin, const gfx::Size& size, bool align_right) { @@ -81,7 +81,7 @@ class DropDownMenuLocator : public chromeos::MenuLocator { return DEFAULT; } - virtual void Move(DOMUIMenuWidget* widget) { + virtual void Move(WebUIMenuWidget* widget) { // TODO(oshima): // Dropdown Menu has to be shown above the button, which is not currently // possible with Menu2. I'll update Menu2 and this code @@ -91,7 +91,7 @@ class DropDownMenuLocator : public chromeos::MenuLocator { UpdateRootMenuBounds(widget, origin_, bounds.size(), !base::i18n::IsRTL()); } - virtual void SetBounds(DOMUIMenuWidget* widget, const gfx::Size& size) { + virtual void SetBounds(WebUIMenuWidget* widget, const gfx::Size& size) { gfx::Size new_size(size); new_size.Enlarge(0, kMenuCornerRadius); UpdateRootMenuBounds(widget, origin_, size, !base::i18n::IsRTL()); @@ -128,13 +128,13 @@ class ContextMenuLocator : public chromeos::MenuLocator { return DEFAULT; } - virtual void Move(DOMUIMenuWidget* widget) { + virtual void Move(WebUIMenuWidget* widget) { gfx::Rect bounds; widget->GetBounds(&bounds, false); UpdateRootMenuBounds(widget, origin_, bounds.size(), base::i18n::IsRTL()); } - virtual void SetBounds(DOMUIMenuWidget* widget, const gfx::Size& size) { + virtual void SetBounds(WebUIMenuWidget* widget, const gfx::Size& size) { gfx::Size new_size(size); new_size.Enlarge(0, kMenuCornerRadius * 2); UpdateRootMenuBounds(widget, origin_, new_size, base::i18n::IsRTL()); @@ -162,7 +162,7 @@ class ContextMenuLocator : public chromeos::MenuLocator { // MenuLocator for submenu. class SubMenuLocator : public chromeos::MenuLocator { public: - SubMenuLocator(const DOMUIMenuWidget* parent, + SubMenuLocator(const WebUIMenuWidget* parent, MenuLocator::SubmenuDirection parent_direction, int y) : parent_rect_(GetBoundsOf(parent)), @@ -177,13 +177,13 @@ class SubMenuLocator : public chromeos::MenuLocator { return direction_; } - virtual void Move(DOMUIMenuWidget* widget) { + virtual void Move(WebUIMenuWidget* widget) { gfx::Rect bounds; widget->GetBounds(&bounds, false); UpdateBounds(widget, bounds.size()); } - virtual void SetBounds(DOMUIMenuWidget* widget, const gfx::Size& size) { + virtual void SetBounds(WebUIMenuWidget* widget, const gfx::Size& size) { gfx::Size new_size(size); new_size.Enlarge(0, kMenuCornerRadius * 2); UpdateBounds(widget, new_size); @@ -201,7 +201,7 @@ class SubMenuLocator : public chromeos::MenuLocator { static const SkScalar kRightCorners[]; static const SkScalar kLeftCorners[]; - void UpdateBounds(DOMUIMenuWidget* widget, const gfx::Size& size) { + void UpdateBounds(WebUIMenuWidget* widget, const gfx::Size& size) { gfx::Rect screen_rect = GetScreenRectAt(parent_rect_.x(), root_y_); int width = std::min(screen_rect.width(), size.width()); int height = AdjustHeight(widget, size.height(), screen_rect.height()); @@ -309,7 +309,7 @@ MenuLocator* MenuLocator::CreateContextMenuLocator(const gfx::Point& p) { } MenuLocator* MenuLocator::CreateSubMenuLocator( - const DOMUIMenuWidget* parent, + const WebUIMenuWidget* parent, MenuLocator::SubmenuDirection parent_direction, int y) { return new SubMenuLocator(parent, parent_direction, y); diff --git a/chrome/browser/chromeos/views/menu_locator.h b/chrome/browser/chromeos/views/menu_locator.h index 80371f5..cb2744d 100644 --- a/chrome/browser/chromeos/views/menu_locator.h +++ b/chrome/browser/chromeos/views/menu_locator.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -16,7 +16,7 @@ class Size; namespace chromeos { -class DOMUIMenuWidget; +class WebUIMenuWidget; // MenuLocator class contorls where the menu will be placed and // which corners are rounded. @@ -35,10 +35,10 @@ class MenuLocator { virtual SubmenuDirection GetSubmenuDirection() const = 0; // Move the widget to the right position. - virtual void Move(DOMUIMenuWidget* widget) = 0; + virtual void Move(WebUIMenuWidget* widget) = 0; // Resize and move the widget to the right position. - virtual void SetBounds(DOMUIMenuWidget* widget, + virtual void SetBounds(WebUIMenuWidget* widget, const gfx::Size& size) = 0; // Returns the 8 length array of SkScalar that represents 4 corner @@ -67,7 +67,7 @@ class MenuLocator { // direction given by |parent_direction|. 3 corners are // rounded except for the corner that is attached to the widget. static MenuLocator* CreateSubMenuLocator( - const DOMUIMenuWidget* widget, + const WebUIMenuWidget* widget, MenuLocator::SubmenuDirection parent_direction, int y); }; diff --git a/chrome/browser/chromeos/views/native_menu_domui.cc b/chrome/browser/chromeos/views/native_menu_domui.cc index 2fa3395..129f34d 100644 --- a/chrome/browser/chromeos/views/native_menu_domui.cc +++ b/chrome/browser/chromeos/views/native_menu_domui.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -9,8 +9,8 @@ #include "base/message_loop.h" #include "base/string_util.h" #include "chrome/browser/chromeos/dom_ui/menu_ui.h" -#include "chrome/browser/chromeos/views/domui_menu_widget.h" #include "chrome/browser/chromeos/views/menu_locator.h" +#include "chrome/browser/chromeos/views/webui_menu_widget.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" @@ -31,7 +31,7 @@ namespace { using chromeos::NativeMenuDOMUI; -using chromeos::DOMUIMenuWidget; +using chromeos::WebUIMenuWidget; // Returns true if the menu item type specified can be executed as a command. bool MenuTypeCanExecute(ui::MenuModel::ItemType type) { @@ -41,7 +41,7 @@ bool MenuTypeCanExecute(ui::MenuModel::ItemType type) { } gboolean Destroy(GtkWidget* widget, gpointer data) { - DOMUIMenuWidget* menu_widget = static_cast<DOMUIMenuWidget*>(data); + WebUIMenuWidget* menu_widget = static_cast<WebUIMenuWidget*>(data); NativeMenuDOMUI* domui_menu = menu_widget->domui_menu(); // domui_menu can be NULL if widget is destroyed by signal. if (domui_menu) @@ -77,7 +77,7 @@ void NativeMenuDOMUI::SetMenuURL(views::Menu2* menu2, const GURL& url) { gfx::NativeView native = menu2->GetNativeMenu(); DCHECK(native); - DOMUIMenuWidget* widget = DOMUIMenuWidget::FindDOMUIMenuWidget(native); + WebUIMenuWidget* widget = WebUIMenuWidget::FindWebUIMenuWidget(native); DCHECK(widget); widget->domui_menu()->set_menu_url(url); } @@ -97,7 +97,7 @@ NativeMenuDOMUI::NativeMenuDOMUI(ui::MenuModel* menu_model, bool root) menu_url_(StringPrintf("chrome://%s", chrome::kChromeUIMenu)), on_menu_opened_called_(false), nested_dispatcher_(NULL) { - menu_widget_ = new DOMUIMenuWidget(this, root); + menu_widget_ = new WebUIMenuWidget(this, root); // Set the initial location off the screen not to show small // window with dropshadow. menu_widget_->Init(NULL, gfx::Rect(-10000, -10000, 1, 1)); diff --git a/chrome/browser/chromeos/views/native_menu_domui.h b/chrome/browser/chromeos/views/native_menu_domui.h index 7b79d80..7222b49 100644 --- a/chrome/browser/chromeos/views/native_menu_domui.h +++ b/chrome/browser/chromeos/views/native_menu_domui.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -11,7 +11,7 @@ #include "base/message_loop.h" #include "base/observer_list.h" #include "base/scoped_ptr.h" -#include "chrome/browser/chromeos/dom_ui/domui_menu_control.h" +#include "chrome/browser/chromeos/webui_menu_control.h" #include "googleurl/src/gurl.h" #include "views/controls/menu/menu_wrapper.h" @@ -34,11 +34,11 @@ typedef union _XEvent XEvent; namespace chromeos { class MenuLocator; -class DOMUIMenuWidget; +class WebUIMenuWidget; // A DOMUI implementation of MenuWrapper. class NativeMenuDOMUI : public views::MenuWrapper, - public DOMUIMenuControl, + public WebUIMenuControl, public MessageLoop::Dispatcher { public: NativeMenuDOMUI(ui::MenuModel* menu_model, bool root); @@ -50,7 +50,7 @@ class NativeMenuDOMUI : public views::MenuWrapper, // Set parent menu. void set_parent(NativeMenuDOMUI* parent) { parent_ = parent; } - // Overridden from MenuWrapper: + // Overridden from views::MenuWrapper: virtual void RunMenuAt(const gfx::Point& point, int alignment); virtual void CancelMenu(); virtual void Rebuild(); @@ -61,14 +61,14 @@ class NativeMenuDOMUI : public views::MenuWrapper, virtual void RemoveMenuListener(views::MenuListener* listener); virtual void SetMinimumWidth(int width); - // Overriden from MessageLoopForUI::Dispatcher: + // Overridden from MessageLoopForUI::Dispatcher: virtual bool Dispatch(GdkEvent* event); #if defined(TOUCH_UI) virtual base::MessagePumpGlibXDispatcher::DispatchStatus Dispatch( XEvent* xevent); #endif - // Overriden from DOMUIMenuControl; + // Overridden from WebUIMenuControl: virtual ui::MenuModel* GetMenuModel() { return model_; } virtual void Activate(ui::MenuModel* model, int index, @@ -123,7 +123,7 @@ class NativeMenuDOMUI : public views::MenuWrapper, ui::MenuModel* model_; // A window widget that draws the content of the menu. - DOMUIMenuWidget* menu_widget_; + WebUIMenuWidget* menu_widget_; // True if the menu is currently shown. // Used only in root. diff --git a/chrome/browser/chromeos/views/domui_menu_widget.cc b/chrome/browser/chromeos/views/webui_menu_widget.cc index f9366bc..0329775 100644 --- a/chrome/browser/chromeos/views/domui_menu_widget.cc +++ b/chrome/browser/chromeos/views/webui_menu_widget.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/views/domui_menu_widget.h" +#include "chrome/browser/chromeos/views/webui_menu_widget.h" #include <algorithm> @@ -104,27 +104,27 @@ class InsetsLayout : public views::LayoutManager { }; // A gtk widget key used to test if a given WidgetGtk instance is -// DOMUIMenuWidgetKey. -const char* kDOMUIMenuWidgetKey = "__DOMUI_MENU_WIDGET__"; +// a WebUIMenuWidgetKey. +const char* kWebUIMenuWidgetKey = "__WEBUI_MENU_WIDGET__"; } // namespace namespace chromeos { // static -DOMUIMenuWidget* DOMUIMenuWidget::FindDOMUIMenuWidget(gfx::NativeView native) { +WebUIMenuWidget* WebUIMenuWidget::FindWebUIMenuWidget(gfx::NativeView native) { DCHECK(native); native = gtk_widget_get_toplevel(native); if (!native) return NULL; - return static_cast<chromeos::DOMUIMenuWidget*>( - g_object_get_data(G_OBJECT(native), kDOMUIMenuWidgetKey)); + return static_cast<chromeos::WebUIMenuWidget*>( + g_object_get_data(G_OBJECT(native), kWebUIMenuWidgetKey)); } /////////////////////////////////////////////////////////////////////////////// -// DOMUIMenuWidget public: +// WebUIMenuWidget public: -DOMUIMenuWidget::DOMUIMenuWidget(chromeos::NativeMenuDOMUI* domui_menu, +WebUIMenuWidget::WebUIMenuWidget(chromeos::NativeMenuDOMUI* domui_menu, bool root) : views::WidgetGtk(views::WidgetGtk::TYPE_POPUP), domui_menu_(domui_menu), @@ -137,25 +137,25 @@ DOMUIMenuWidget::DOMUIMenuWidget(chromeos::NativeMenuDOMUI* domui_menu, // MakeTransparent(); } -DOMUIMenuWidget::~DOMUIMenuWidget() { +WebUIMenuWidget::~WebUIMenuWidget() { } -void DOMUIMenuWidget::Init(gfx::NativeView parent, const gfx::Rect& bounds) { +void WebUIMenuWidget::Init(gfx::NativeView parent, const gfx::Rect& bounds) { WidgetGtk::Init(parent, bounds); gtk_window_set_destroy_with_parent(GTK_WINDOW(GetNativeView()), TRUE); gtk_window_set_type_hint(GTK_WINDOW(GetNativeView()), GDK_WINDOW_TYPE_HINT_MENU); - g_object_set_data(G_OBJECT(GetNativeView()), kDOMUIMenuWidgetKey, this); + g_object_set_data(G_OBJECT(GetNativeView()), kWebUIMenuWidgetKey, this); } -void DOMUIMenuWidget::Hide() { +void WebUIMenuWidget::Hide() { ReleaseGrab(); WidgetGtk::Hide(); // Clears the content. ExecuteJavascript(L"updateModel({'items':[]})"); } -void DOMUIMenuWidget::Close() { +void WebUIMenuWidget::Close() { if (dom_view_ != NULL) { dom_view_->GetParent()->RemoveChildView(dom_view_); delete dom_view_; @@ -167,7 +167,7 @@ void DOMUIMenuWidget::Close() { views::WidgetGtk::Close(); } -void DOMUIMenuWidget::ReleaseGrab() { +void WebUIMenuWidget::ReleaseGrab() { WidgetGtk::ReleaseGrab(); if (did_input_grab_) { did_input_grab_ = false; @@ -178,14 +178,14 @@ void DOMUIMenuWidget::ReleaseGrab() { } } -gboolean DOMUIMenuWidget::OnGrabBrokeEvent(GtkWidget* widget, +gboolean WebUIMenuWidget::OnGrabBrokeEvent(GtkWidget* widget, GdkEvent* event) { did_input_grab_ = false; Hide(); return WidgetGtk::OnGrabBrokeEvent(widget, event); } -void DOMUIMenuWidget::OnSizeAllocate(GtkWidget* widget, +void WebUIMenuWidget::OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation) { views::WidgetGtk::OnSizeAllocate(widget, allocation); // Adjust location when menu gets resized. @@ -199,7 +199,7 @@ void DOMUIMenuWidget::OnSizeAllocate(GtkWidget* widget, } gboolean MapToFocus(GtkWidget* widget, GdkEvent* event, gpointer data) { - DOMUIMenuWidget* menu_widget = DOMUIMenuWidget::FindDOMUIMenuWidget(widget); + WebUIMenuWidget* menu_widget = WebUIMenuWidget::FindWebUIMenuWidget(widget); if (menu_widget) { // See EnableInput for the meaning of data. bool select_item = data != NULL; @@ -208,12 +208,12 @@ gboolean MapToFocus(GtkWidget* widget, GdkEvent* event, gpointer data) { return true; } -void DOMUIMenuWidget::EnableScroll(bool enable) { +void WebUIMenuWidget::EnableScroll(bool enable) { ExecuteJavascript(StringPrintf( L"enableScroll(%ls)", enable ? L"true" : L"false")); } -void DOMUIMenuWidget::EnableInput(bool select_item) { +void WebUIMenuWidget::EnableInput(bool select_item) { if (!dom_view_) return; DCHECK(dom_view_->tab_contents()->render_view_host()); @@ -244,8 +244,8 @@ void DOMUIMenuWidget::EnableInput(bool select_item) { } } -void DOMUIMenuWidget::ExecuteJavascript(const std::wstring& script) { - // Don't exeute there is no DOMView associated. This is fine because +void WebUIMenuWidget::ExecuteJavascript(const std::wstring& script) { + // Don't execute if there is no DOMView associated. This is fine because // 1) selectItem make sense only when DOMView is associated. // 2) updateModel will be called again when a DOMView is created/assigned. if (!dom_view_) @@ -256,7 +256,7 @@ void DOMUIMenuWidget::ExecuteJavascript(const std::wstring& script) { ExecuteJavascriptInWebFrame(std::wstring(), script); } -void DOMUIMenuWidget::ShowAt(chromeos::MenuLocator* locator) { +void WebUIMenuWidget::ShowAt(chromeos::MenuLocator* locator) { DCHECK(domui_menu_); menu_locator_.reset(locator); if (!dom_view_) { @@ -286,7 +286,7 @@ void DOMUIMenuWidget::ShowAt(chromeos::MenuLocator* locator) { } } -void DOMUIMenuWidget::SetSize(const gfx::Size& new_size) { +void WebUIMenuWidget::SetSize(const gfx::Size& new_size) { DCHECK(domui_menu_); // Ignore the empty new_size request which is called when // menu.html is loaded. @@ -305,9 +305,9 @@ void DOMUIMenuWidget::SetSize(const gfx::Size& new_size) { } /////////////////////////////////////////////////////////////////////////////// -// DOMUIMenuWidget private: +// WebUIMenuWidget private: -void DOMUIMenuWidget::CaptureGrab() { +void WebUIMenuWidget::CaptureGrab() { // Release the current grab. ClearGrabWidget(); @@ -331,7 +331,7 @@ void DOMUIMenuWidget::CaptureGrab() { EnableInput(false /* no selection */); } -void DOMUIMenuWidget::ClearGrabWidget() { +void WebUIMenuWidget::ClearGrabWidget() { GtkWidget* grab_widget; while ((grab_widget = gtk_grab_get_current())) gtk_grab_remove(grab_widget); diff --git a/chrome/browser/chromeos/views/domui_menu_widget.h b/chrome/browser/chromeos/views/webui_menu_widget.h index 095d4c4..1579250 100644 --- a/chrome/browser/chromeos/views/domui_menu_widget.h +++ b/chrome/browser/chromeos/views/webui_menu_widget.h @@ -1,9 +1,9 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_VIEWS_DOMUI_MENU_WIDGET_H_ -#define CHROME_BROWSER_CHROMEOS_VIEWS_DOMUI_MENU_WIDGET_H_ +#ifndef CHROME_BROWSER_CHROMEOS_VIEWS_WEBUI_MENU_WIDGET_H_ +#define CHROME_BROWSER_CHROMEOS_VIEWS_WEBUI_MENU_WIDGET_H_ #pragma once #include <string> @@ -18,13 +18,13 @@ namespace chromeos { class MenuLocator; class NativeMenuDOMUI; -// DOMUIMenuWidget is a window widget for DOMUI based menu. -class DOMUIMenuWidget : public views::WidgetGtk { +// WebUIMenuWidget is a window widget for a Web UI based menu. +class WebUIMenuWidget : public views::WidgetGtk { public: // Create a Window for the NativeMenuDMOUI. |root| specifies if // the menu is root menu. - DOMUIMenuWidget(NativeMenuDOMUI* domui_menu, bool root); - virtual ~DOMUIMenuWidget(); + WebUIMenuWidget(NativeMenuDOMUI* domui_menu, bool root); + virtual ~WebUIMenuWidget(); // WidgetGtk overrides: virtual void Init(gfx::NativeView parent, const gfx::Rect& bounds); @@ -72,9 +72,9 @@ class DOMUIMenuWidget : public views::WidgetGtk { return menu_locator_.get(); } - // Returns DOMUIMenuWidget that contains given native. This returns + // Returns WebUIMenuWidget that contains given native. This returns // NULL if not found. - static DOMUIMenuWidget* FindDOMUIMenuWidget(gfx::NativeView native); + static WebUIMenuWidget* FindWebUIMenuWidget(gfx::NativeView native); private: // Capture the X pointer grab. This also enables input on the widget by @@ -100,9 +100,9 @@ class DOMUIMenuWidget : public views::WidgetGtk { // submenu chain). bool is_root_; - DISALLOW_COPY_AND_ASSIGN(DOMUIMenuWidget); + DISALLOW_COPY_AND_ASSIGN(WebUIMenuWidget); }; } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_VIEWS_DOMUI_MENU_WIDGET_H_ +#endif // CHROME_BROWSER_CHROMEOS_VIEWS_WEBUI_MENU_WIDGET_H_ diff --git a/chrome/browser/chromeos/dom_ui/domui_menu_control.h b/chrome/browser/chromeos/webui_menu_control.h index 2e4cc93..3cb545c 100644 --- a/chrome/browser/chromeos/dom_ui/domui_menu_control.h +++ b/chrome/browser/chromeos/webui_menu_control.h @@ -1,9 +1,9 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_DOM_UI_DOMUI_MENU_CONTROL_H_ -#define CHROME_BROWSER_CHROMEOS_DOM_UI_DOMUI_MENU_CONTROL_H_ +#ifndef CHROME_BROWSER_CHROMEOS_WEBUI_MENU_CONTROL_H_ +#define CHROME_BROWSER_CHROMEOS_WEBUI_MENU_CONTROL_H_ #pragma once namespace gfx { @@ -16,17 +16,17 @@ class MenuModel; namespace chromeos { -// DOMUIMenuControl class is used to control the UI counterpart of -// a MenuModel. One instance of DOMUIMenuControl is created for each +// WebUIMenuControl class is used to control the UI counterpart of +// a MenuModel. One instance of WebUIMenuControl is created for each // MenuModel instance, that is, a submenu will have its own -// DOMUIMenuControl. -class DOMUIMenuControl { +// WebUIMenuControl. +class WebUIMenuControl { public: enum ActivationMode { ACTIVATE_NO_CLOSE, // Activate the command without closing menu. CLOSE_AND_ACTIVATE, // Close the menu and then activate the command. }; - virtual ~DOMUIMenuControl() {} + virtual ~WebUIMenuControl() {} // Returns the MenuModel associated with this control. virtual ui::MenuModel* GetMenuModel() = 0; @@ -63,4 +63,4 @@ class DOMUIMenuControl { } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_DOM_UI_DOMUI_MENU_CONTROL_H_ +#endif // CHROME_BROWSER_CHROMEOS_WEBUI_MENU_CONTROL_H_ diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 700364d..8d11cc6 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -457,7 +457,6 @@ 'browser/chromeos/dom_ui/core_chromeos_options_handler.h', 'browser/chromeos/dom_ui/cros_options_page_ui_handler.cc', 'browser/chromeos/dom_ui/cros_options_page_ui_handler.h', - 'browser/chromeos/dom_ui/domui_menu_control.h', 'browser/chromeos/dom_ui/imageburner_ui.cc', 'browser/chromeos/dom_ui/imageburner_ui.h', 'browser/chromeos/dom_ui/internet_options_handler.cc', @@ -770,16 +769,17 @@ 'browser/chromeos/view_ids.h', 'browser/chromeos/views/copy_background.cc', 'browser/chromeos/views/copy_background.h', - 'browser/chromeos/views/domui_menu_widget.cc', - 'browser/chromeos/views/domui_menu_widget.h', 'browser/chromeos/views/dropdown_button.cc', 'browser/chromeos/views/dropdown_button.h', 'browser/chromeos/views/menu_locator.cc', 'browser/chromeos/views/menu_locator.h', 'browser/chromeos/views/native_menu_domui.cc', 'browser/chromeos/views/native_menu_domui.h', + 'browser/chromeos/views/webui_menu_widget.cc', + 'browser/chromeos/views/webui_menu_widget.h', 'browser/chromeos/volume_bubble.cc', 'browser/chromeos/volume_bubble.h', + 'browser/chromeos/webui_menu_control.h', 'browser/chromeos/wm_ipc.cc', 'browser/chromeos/wm_ipc.h', 'browser/chromeos/wm_message_listener.cc', |