diff options
-rw-r--r-- | chrome/browser/views/toolbar_view.cc | 24 | ||||
-rw-r--r-- | chrome/browser/views/toolbar_view.h | 8 | ||||
-rw-r--r-- | views/controls/button/menu_button.h | 9 |
3 files changed, 20 insertions, 21 deletions
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index 4c46d38..ddbbe0f 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -457,10 +457,10 @@ void BrowserToolbarView::DidGainFocus() { view_index = acc_focused_view_->GetID(); } - HWND hwnd = GetWidget()->GetNativeView(); + gfx::NativeView wnd = GetWidget()->GetNativeView(); // Notify Access Technology that there was a change in keyboard focus. - ::NotifyWinEvent(EVENT_OBJECT_FOCUS, hwnd, OBJID_CLIENT, + ::NotifyWinEvent(EVENT_OBJECT_FOCUS, wnd, OBJID_CLIENT, static_cast<LONG>(view_index)); } @@ -530,7 +530,7 @@ bool BrowserToolbarView::OnKeyPressed(const views::KeyEvent& e) { // Retrieve information to generate an MSAA focus event. int view_id = acc_focused_view_->GetID(); - HWND hwnd = GetWidget()->GetNativeView(); + gfx::NativeView wnd = GetWidget()->GetNativeView(); // Show the tooltip for the view that got the focus. if (GetWidget()->GetTooltipManager()) { @@ -538,7 +538,7 @@ bool BrowserToolbarView::OnKeyPressed(const views::KeyEvent& e) { ShowKeyboardTooltip(GetChildViewAt(next_view)); } // Notify Access Technology that there was a change in keyboard focus. - ::NotifyWinEvent(EVENT_OBJECT_FOCUS, hwnd, OBJID_CLIENT, + ::NotifyWinEvent(EVENT_OBJECT_FOCUS, wnd, OBJID_CLIENT, static_cast<LONG>(view_id)); return true; } @@ -582,12 +582,13 @@ gfx::Size BrowserToolbarView::GetPreferredSize() { vertical_spacing); } -void BrowserToolbarView::RunPageMenu(const gfx::Point& pt, HWND hwnd) { +void BrowserToolbarView::RunPageMenu(const gfx::Point& pt, + gfx::NativeView parent) { views::Menu::AnchorPoint anchor = views::Menu::TOPRIGHT; if (UILayoutIsRightToLeft()) anchor = views::Menu::TOPLEFT; - scoped_ptr<views::Menu> menu(views::Menu::Create(this, anchor, hwnd)); + scoped_ptr<views::Menu> menu(views::Menu::Create(this, anchor, parent)); menu->AppendMenuItemWithLabel(IDC_CREATE_SHORTCUTS, l10n_util::GetString(IDS_CREATE_SHORTCUTS)); menu->AppendSeparator(); @@ -656,12 +657,13 @@ void BrowserToolbarView::RunPageMenu(const gfx::Point& pt, HWND hwnd) { menu->RunMenuAt(pt.x(), pt.y()); } -void BrowserToolbarView::RunAppMenu(const gfx::Point& pt, HWND hwnd) { +void BrowserToolbarView::RunAppMenu(const gfx::Point& pt, + gfx::NativeView parent) { views::Menu::AnchorPoint anchor = views::Menu::TOPRIGHT; if (UILayoutIsRightToLeft()) anchor = views::Menu::TOPLEFT; - scoped_ptr<views::Menu> menu(views::Menu::Create(this, anchor, hwnd)); + scoped_ptr<views::Menu> menu(views::Menu::Create(this, anchor, parent)); menu->AppendMenuItemWithLabel(IDC_NEW_TAB, l10n_util::GetString(IDS_NEW_TAB)); menu->AppendMenuItemWithLabel(IDC_NEW_WINDOW, l10n_util::GetString(IDS_NEW_WINDOW)); @@ -726,13 +728,13 @@ bool BrowserToolbarView::IsItemChecked(int id) const { } void BrowserToolbarView::RunMenu(views::View* source, const gfx::Point& pt, - HWND hwnd) { + gfx::NativeView parent) { switch (source->GetID()) { case VIEW_ID_PAGE_MENU: - RunPageMenu(pt, hwnd); + RunPageMenu(pt, parent); break; case VIEW_ID_APP_MENU: - RunAppMenu(pt, hwnd); + RunAppMenu(pt, parent); break; default: NOTREACHED() << "Invalid source menu."; diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h index 9242466b..9d4edda 100644 --- a/chrome/browser/views/toolbar_view.h +++ b/chrome/browser/views/toolbar_view.h @@ -14,7 +14,6 @@ #include "chrome/browser/encoding_menu_controller_delegate.h" #include "chrome/browser/user_data_manager.h" #include "chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h" -#include "chrome/browser/views/dom_view.h" #include "chrome/browser/views/go_button.h" #include "chrome/browser/views/location_bar_view.h" #include "chrome/common/pref_member.h" @@ -72,7 +71,8 @@ class BrowserToolbarView : public views::View, virtual bool GetAcceleratorInfo(int id, views::Accelerator* accel); // views::MenuDelegate - virtual void RunMenu(views::View* source, const gfx::Point& pt, HWND hwnd); + virtual void RunMenu(views::View* source, const gfx::Point& pt, + gfx::NativeView hwnd); // GetProfilesHelper::Delegate method. virtual void OnGetProfilesDone(const std::vector<std::wstring>& profiles); @@ -157,10 +157,10 @@ class BrowserToolbarView : public views::View, void SetSecurityLevel(ToolbarModel::SecurityLevel security_level); // Show the page menu. - void RunPageMenu(const gfx::Point& pt, HWND hwnd); + void RunPageMenu(const gfx::Point& pt, gfx::NativeView hwnd); // Show the app menu. - void RunAppMenu(const gfx::Point& pt, HWND hwnd); + void RunAppMenu(const gfx::Point& pt, gfx::NativeView hwnd); // Overridden from View, to pass keyboard triggering of the right-click // context menu on to the toolbar child view that currently has the diff --git a/views/controls/button/menu_button.h b/views/controls/button/menu_button.h index c9a39dd..e17f65d 100644 --- a/views/controls/button/menu_button.h +++ b/views/controls/button/menu_button.h @@ -5,8 +5,6 @@ #ifndef VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ #define VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ -#include <windows.h> - #include "app/gfx/font.h" #include "base/time.h" #include "views/background.h" @@ -59,17 +57,16 @@ class MenuButton : public TextButton { virtual bool GetAccessibleState(AccessibilityTypes::State* state); protected: - // true if the menu is currently visible. + // True if the menu is currently visible. bool menu_visible_; private: + friend class TextButtonBackground; // Compute the maximum X coordinate for the current screen. MenuButtons // use this to make sure a menu is never shown off screen. int GetMaximumScreenXCoordinate(); - DISALLOW_EVIL_CONSTRUCTORS(MenuButton); - // We use a time object in order to keep track of when the menu was closed. // The time is used for simulating menu behavior for the menu button; that // is, if the menu is shown and the button is pressed, we need to close the @@ -84,7 +81,7 @@ class MenuButton : public TextButton { // Whether or not we're showing a drop marker. bool show_menu_marker_; - friend class TextButtonBackground; + DISALLOW_COPY_AND_ASSIGN(MenuButton); }; } // namespace views |