diff options
Diffstat (limited to 'chrome/browser')
18 files changed, 138 insertions, 125 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc index be81645..35bd86b 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc @@ -469,7 +469,7 @@ AutocompleteEditViewWin::AutocompleteEditViewWin( SetDefaultCharFormat(cf); // Set up context menu. - context_menu_.reset(new Menu(this, Menu::TOPLEFT, m_hWnd)); + context_menu_.reset(views::Menu::Create(this, views::Menu::TOPLEFT, m_hWnd)); if (popup_window_mode_) { context_menu_->AppendMenuItemWithLabel(IDS_COPY, l10n_util::GetString(IDS_COPY)); diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.h b/chrome/browser/autocomplete/autocomplete_edit_view_win.h index 6c74cc9..7b00044 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.h @@ -44,7 +44,7 @@ class AutocompleteEditViewWin CWinTraits<WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | ES_NOHIDESEL> >, public CRichEditCommands<AutocompleteEditViewWin>, - public Menu::Delegate, + public views::Menu::Delegate, public AutocompleteEditView { public: struct State { @@ -424,7 +424,7 @@ class AutocompleteEditViewWin CHARRANGE saved_selection_for_focus_change_; // The context menu for the edit. - scoped_ptr<Menu> context_menu_; + scoped_ptr<views::Menu> context_menu_; // Font we're using. We keep a reference to make sure the font supplied to // the constructor doesn't go away before we do. diff --git a/chrome/browser/back_forward_menu_model_win.h b/chrome/browser/back_forward_menu_model_win.h index e1805cb..ed308df 100644 --- a/chrome/browser/back_forward_menu_model_win.h +++ b/chrome/browser/back_forward_menu_model_win.h @@ -13,7 +13,7 @@ class SkBitmap; class BackForwardMenuModelWin : public BackForwardMenuModel, - public Menu::Delegate { + public views::Menu::Delegate { public: BackForwardMenuModelWin(Browser* browser, ModelType model_type); diff --git a/chrome/browser/encoding_menu_controller_delegate.cc b/chrome/browser/encoding_menu_controller_delegate.cc index 6faac2d..6e45ec8 100644 --- a/chrome/browser/encoding_menu_controller_delegate.cc +++ b/chrome/browser/encoding_menu_controller_delegate.cc @@ -53,7 +53,7 @@ void EncodingMenuControllerDelegate::ExecuteCommand(int id) { } void EncodingMenuControllerDelegate::BuildEncodingMenu( - Profile* profile, Menu* encoding_menu) { + Profile* profile, views::Menu* encoding_menu) { typedef EncodingMenuController::EncodingMenuItemList EncodingMenuItemList; EncodingMenuItemList menuItems; EncodingMenuController controller; @@ -62,7 +62,7 @@ void EncodingMenuControllerDelegate::BuildEncodingMenu( for (EncodingMenuItemList::iterator it = menuItems.begin(); it != menuItems.end(); ++it) { - Menu::MenuItemType type = Menu::RADIO; + views::Menu::MenuItemType type = views::Menu::RADIO; int id = it->first; std::wstring &localized_title = it->second; @@ -70,7 +70,7 @@ void EncodingMenuControllerDelegate::BuildEncodingMenu( encoding_menu->AppendSeparator(); } else { if (id == IDC_ENCODING_AUTO_DETECT) { - type = Menu::CHECKBOX; + type = views::Menu::CHECKBOX; } encoding_menu->AppendMenuItem(id, localized_title, type); diff --git a/chrome/browser/encoding_menu_controller_delegate.h b/chrome/browser/encoding_menu_controller_delegate.h index f35a5e4..b052fc8a 100644 --- a/chrome/browser/encoding_menu_controller_delegate.h +++ b/chrome/browser/encoding_menu_controller_delegate.h @@ -14,7 +14,7 @@ class Profile; // Encapsulates logic about populating the encoding menu and making // sure the correct items are checked. -class EncodingMenuControllerDelegate : public Menu::Delegate { +class EncodingMenuControllerDelegate : public views::Menu::Delegate { public: explicit EncodingMenuControllerDelegate(Browser* browser); @@ -29,7 +29,7 @@ class EncodingMenuControllerDelegate : public Menu::Delegate { // is used in both the simple frame menu and in the page menu in the // toolbar. (And probably elsewhere in the future, hence the // dedicated delegate). - static void BuildEncodingMenu(Profile* profile, Menu* encoding_menu); + static void BuildEncodingMenu(Profile* profile, views::Menu* encoding_menu); private: Browser* browser_; diff --git a/chrome/browser/tab_contents/render_view_context_menu_win.cc b/chrome/browser/tab_contents/render_view_context_menu_win.cc index 87dce53..dbb1ead 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_win.cc +++ b/chrome/browser/tab_contents/render_view_context_menu_win.cc @@ -14,7 +14,7 @@ RenderViewContextMenuWin::RenderViewContextMenuWin( const ContextMenuParams& params, HWND owner) : RenderViewContextMenu(tab_contents, params), - ALLOW_THIS_IN_INITIALIZER_LIST(menu_(this, Menu::TOPLEFT, owner)), + ALLOW_THIS_IN_INITIALIZER_LIST(menu_(this, views::Menu::TOPLEFT, owner)), sub_menu_(NULL) { InitMenu(params.node); } @@ -27,26 +27,26 @@ void RenderViewContextMenuWin::RunMenuAt(int x, int y) { } void RenderViewContextMenuWin::AppendMenuItem(int id) { - AppendItem(id, l10n_util::GetString(id), Menu::NORMAL); + AppendItem(id, l10n_util::GetString(id), views::Menu::NORMAL); } void RenderViewContextMenuWin::AppendMenuItem(int id, const std::wstring& label) { - AppendItem(id, label, Menu::NORMAL); + AppendItem(id, label, views::Menu::NORMAL); } void RenderViewContextMenuWin::AppendRadioMenuItem(int id, const std::wstring& label) { - AppendItem(id, label, Menu::RADIO); + AppendItem(id, label, views::Menu::RADIO); } void RenderViewContextMenuWin::AppendCheckboxMenuItem(int id, const std::wstring& label) { - AppendItem(id, label, Menu::CHECKBOX); + AppendItem(id, label, views::Menu::CHECKBOX); } void RenderViewContextMenuWin::AppendSeparator() { - Menu* menu = sub_menu_ ? sub_menu_ : &menu_; + views::Menu* menu = sub_menu_ ? sub_menu_ : &menu_; menu->AppendSeparator(); } @@ -66,8 +66,8 @@ void RenderViewContextMenuWin::FinishSubMenu() { void RenderViewContextMenuWin::AppendItem( int id, const std::wstring& label, - Menu::MenuItemType type) { - Menu* menu = sub_menu_ ? sub_menu_ : &menu_; + views::Menu::MenuItemType type) { + views::Menu* menu = sub_menu_ ? sub_menu_ : &menu_; menu->AppendMenuItem(id, label, type); } diff --git a/chrome/browser/tab_contents/render_view_context_menu_win.h b/chrome/browser/tab_contents/render_view_context_menu_win.h index bc9578e..5d64342 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_win.h +++ b/chrome/browser/tab_contents/render_view_context_menu_win.h @@ -7,10 +7,10 @@ #include "chrome/browser/tab_contents/render_view_context_menu.h" #include "views/accelerator.h" -#include "views/controls/menu/menu.h" +#include "views/controls/menu/menu_win.h" class RenderViewContextMenuWin : public RenderViewContextMenu, - public Menu::Delegate{ + public views::Menu::Delegate { public: RenderViewContextMenuWin(TabContents* tab_contents, const ContextMenuParams& params, @@ -39,10 +39,12 @@ class RenderViewContextMenuWin : public RenderViewContextMenu, private: // Append the item to |sub_menu_| if it exists, or |menu_| otherwise. - void AppendItem(int id, const std::wstring& label, Menu::MenuItemType type); + void AppendItem(int id, + const std::wstring& label, + views::Menu::MenuItemType type); - Menu menu_; - Menu* sub_menu_; + views::MenuWin menu_; + views::Menu* sub_menu_; }; #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_WIN_H_ diff --git a/chrome/browser/task_manager_win.cc b/chrome/browser/task_manager_win.cc index 9fa0eba..d20d5a2 100644 --- a/chrome/browser/task_manager_win.cc +++ b/chrome/browser/task_manager_win.cc @@ -167,7 +167,7 @@ class TaskManagerViewImpl : public TaskManagerView, public views::TableViewObserver, public views::LinkController, public views::ContextMenuController, - public Menu::Delegate { + public views::Menu::Delegate { public: TaskManagerViewImpl(TaskManager* task_manager, TaskManagerModel* model); @@ -498,12 +498,13 @@ void TaskManagerViewImpl::ShowContextMenu(views::View* source, int y, bool is_mouse_gesture) { UpdateStatsCounters(); - Menu menu(this, Menu::TOPLEFT, source->GetWidget()->GetNativeView()); + scoped_ptr<views::Menu> menu(views::Menu::Create( + this, views::Menu::TOPLEFT, source->GetWidget()->GetNativeView())); for (std::vector<views::TableColumn>::iterator i = columns_.begin(); i != columns_.end(); ++i) { - menu.AppendMenuItem(i->id, i->title, Menu::CHECKBOX); + menu->AppendMenuItem(i->id, i->title, views::Menu::CHECKBOX); } - menu.RunMenuAt(x, y); + menu->RunMenuAt(x, y); } bool TaskManagerViewImpl::IsItemChecked(int id) const { diff --git a/chrome/browser/views/blocked_popup_container.cc b/chrome/browser/views/blocked_popup_container.cc index 47e5f8e..b94adb1 100644 --- a/chrome/browser/views/blocked_popup_container.cc +++ b/chrome/browser/views/blocked_popup_container.cc @@ -179,8 +179,8 @@ gfx::Size BlockedPopupContainerView::GetPreferredSize() { void BlockedPopupContainerView::ButtonPressed(views::Button* sender) { if (sender == popup_count_label_) { - launch_menu_.reset(new Menu(this, Menu::TOPLEFT, - container_->GetNativeView())); + launch_menu_.reset(views::Menu::Create(this, views::Menu::TOPLEFT, + container_->GetNativeView())); // Set items 1 .. popup_count as individual popups. size_t popup_count = container_->GetBlockedPopupCount(); @@ -191,7 +191,7 @@ void BlockedPopupContainerView::ButtonPressed(views::Button* sender) { // the value 0 as the nop command. launch_menu_->AppendMenuItem(i + 1, l10n_util::GetStringF(IDS_POPUP_TITLE_FORMAT, url, title), - Menu::NORMAL); + views::Menu::NORMAL); } // Set items (kImpossibleNumberOfPopups + 1) .. @@ -201,7 +201,8 @@ void BlockedPopupContainerView::ButtonPressed(views::Button* sender) { launch_menu_->AppendSeparator(); for (size_t i = 0; i < hosts.size(); ++i) { launch_menu_->AppendMenuItem(kImpossibleNumberOfPopups + i + 1, - l10n_util::GetStringF(IDS_POPUP_HOST_FORMAT, hosts[i]), Menu::NORMAL); + l10n_util::GetStringF(IDS_POPUP_HOST_FORMAT, hosts[i]), + views::Menu::NORMAL); } CPoint cursor_position; diff --git a/chrome/browser/views/blocked_popup_container.h b/chrome/browser/views/blocked_popup_container.h index 640bdd0..dcf7d8f 100644 --- a/chrome/browser/views/blocked_popup_container.h +++ b/chrome/browser/views/blocked_popup_container.h @@ -39,7 +39,7 @@ class ImageButton; // blocked. This view should only be used inside of BlockedPopupContainer. class BlockedPopupContainerView : public views::View, public views::ButtonListener, - public Menu::Delegate { + public views::Menu::Delegate { public: explicit BlockedPopupContainerView(BlockedPopupContainer* container); ~BlockedPopupContainerView(); @@ -79,7 +79,7 @@ class BlockedPopupContainerView : public views::View, views::ImageButton* close_button_; // Popup menu shown to user. - scoped_ptr<Menu> launch_menu_; + scoped_ptr<views::Menu> launch_menu_; DISALLOW_IMPLICIT_CONSTRUCTORS(BlockedPopupContainerView); }; diff --git a/chrome/browser/views/bookmark_bar_view.h b/chrome/browser/views/bookmark_bar_view.h index ccf787e..1986d2f 100644 --- a/chrome/browser/views/bookmark_bar_view.h +++ b/chrome/browser/views/bookmark_bar_view.h @@ -42,7 +42,7 @@ class BookmarkBarView : public views::View, public BookmarkModelObserver, public views::ViewMenuDelegate, public views::ButtonListener, - public Menu::Delegate, + public views::Menu::Delegate, public NotificationObserver, public views::ContextMenuController, public views::DragController, diff --git a/chrome/browser/views/bookmark_editor_view.cc b/chrome/browser/views/bookmark_editor_view.cc index 0aee8bc..835ba59 100644 --- a/chrome/browser/views/bookmark_editor_view.cc +++ b/chrome/browser/views/bookmark_editor_view.cc @@ -225,8 +225,8 @@ void BookmarkEditorView::ShowContextMenu(View* source, running_menu_for_root_ = (tree_model_->GetParent(tree_view_->GetSelectedNode()) == tree_model_->GetRoot()); - context_menu_.reset(new Menu(this, Menu::TOPLEFT, - GetWidget()->GetNativeView())); + context_menu_.reset(views::Menu::Create(this, views::Menu::TOPLEFT, + GetWidget()->GetNativeView())); context_menu_->AppendMenuItemWithLabel(IDS_EDIT, l10n_util::GetString(IDS_EDIT)); context_menu_->AppendMenuItemWithLabel( diff --git a/chrome/browser/views/bookmark_editor_view.h b/chrome/browser/views/bookmark_editor_view.h index 4ca3fde..754e5f8 100644 --- a/chrome/browser/views/bookmark_editor_view.h +++ b/chrome/browser/views/bookmark_editor_view.h @@ -40,7 +40,7 @@ class BookmarkEditorView : public BookmarkEditor, public views::DialogDelegate, public views::TextField::Controller, public views::ContextMenuController, - public Menu::Delegate, + public views::Menu::Delegate, public BookmarkModelObserver { FRIEND_TEST(BookmarkEditorViewTest, ChangeParent); FRIEND_TEST(BookmarkEditorViewTest, ChangeParentAndURL); @@ -243,7 +243,7 @@ class BookmarkEditorView : public BookmarkEditor, BookmarkNode* node_; // The context menu. - scoped_ptr<Menu> context_menu_; + scoped_ptr<views::Menu> context_menu_; // Mode used to create nodes from. BookmarkModel* bb_model_; diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc index 7aa2a37..1e9554f 100644 --- a/chrome/browser/views/download_item_view.cc +++ b/chrome/browser/views/download_item_view.cc @@ -65,7 +65,7 @@ static const int kDisabledOnOpenDuration = 3000; // DownloadShelfContextMenuWin ------------------------------------------------- class DownloadShelfContextMenuWin : public DownloadShelfContextMenu, - public Menu::Delegate { + public views::Menu::Delegate { public: DownloadShelfContextMenuWin::DownloadShelfContextMenuWin( BaseDownloadItemModel* model, @@ -75,23 +75,27 @@ class DownloadShelfContextMenuWin : public DownloadShelfContextMenu, DCHECK(model); // The menu's anchor point is determined based on the UI layout. - Menu::AnchorPoint anchor_point; + views::Menu::AnchorPoint anchor_point; if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) - anchor_point = Menu::TOPRIGHT; + anchor_point = views::Menu::TOPRIGHT; else - anchor_point = Menu::TOPLEFT; + anchor_point = views::Menu::TOPLEFT; - Menu context_menu(this, anchor_point, window); - if (download_->state() == DownloadItem::COMPLETE) - context_menu.AppendMenuItem(OPEN_WHEN_COMPLETE, L"", Menu::NORMAL); - else - context_menu.AppendMenuItem(OPEN_WHEN_COMPLETE, L"", Menu::CHECKBOX); - context_menu.AppendMenuItem(ALWAYS_OPEN_TYPE, L"", Menu::CHECKBOX); - context_menu.AppendSeparator(); - context_menu.AppendMenuItem(SHOW_IN_FOLDER, L"", Menu::NORMAL); - context_menu.AppendSeparator(); - context_menu.AppendMenuItem(CANCEL, L"", Menu::NORMAL); - context_menu.RunMenuAt(point.x(), point.y()); + scoped_ptr<views::Menu> context_menu( + views::Menu::Create(this, anchor_point, window)); + if (download_->state() == DownloadItem::COMPLETE) { + context_menu->AppendMenuItem(OPEN_WHEN_COMPLETE, L"", + views::Menu::NORMAL); + } else { + context_menu->AppendMenuItem(OPEN_WHEN_COMPLETE, L"", + views::Menu::CHECKBOX); + } + context_menu->AppendMenuItem(ALWAYS_OPEN_TYPE, L"", views::Menu::CHECKBOX); + context_menu->AppendSeparator(); + context_menu->AppendMenuItem(SHOW_IN_FOLDER, L"", views::Menu::NORMAL); + context_menu->AppendSeparator(); + context_menu->AppendMenuItem(CANCEL, L"", views::Menu::NORMAL); + context_menu->RunMenuAt(point.x(), point.y()); } // Menu::Delegate implementation --------------------------------------------- diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index b3aa486..a438cdf 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -60,6 +60,7 @@ #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "grit/webkit_resources.h" +#include "views/controls/menu/menu_win.h" #include "views/controls/scrollbar/native_scroll_bar.h" #include "views/fill_layout.h" #include "views/view.h" @@ -1298,7 +1299,7 @@ void BrowserView::Init() { void BrowserView::InitSystemMenu() { HMENU system_menu = GetSystemMenu(frame_->GetNativeView(), FALSE); - system_menu_.reset(new Menu(system_menu)); + system_menu_.reset(new views::MenuWin(system_menu)); int insertion_index = std::max(0, system_menu_->ItemCount() - 1); // We add the menu items in reverse order so that insertion_index never needs // to change. @@ -1549,7 +1550,7 @@ void BrowserView::LoadAccelerators() { free(accelerators); } -void BrowserView::BuildMenuForTabStriplessWindow(Menu* menu, +void BrowserView::BuildMenuForTabStriplessWindow(views::Menu* menu, int insertion_index) { encoding_menu_delegate_.reset(new EncodingMenuControllerDelegate( browser_.get())); @@ -1560,7 +1561,7 @@ void BrowserView::BuildMenuForTabStriplessWindow(Menu* menu, } else { int command = kMenuLayout[i].command; if (command == IDC_ENCODING_MENU) { - Menu* encoding_menu = menu->AddSubMenu( + views::Menu* encoding_menu = menu->AddSubMenu( insertion_index, IDC_ENCODING_MENU, l10n_util::GetString(IDS_ENCODING_MENU)); @@ -1568,8 +1569,9 @@ void BrowserView::BuildMenuForTabStriplessWindow(Menu* menu, EncodingMenuControllerDelegate::BuildEncodingMenu(browser_->profile(), encoding_menu); } else if (command == IDC_ZOOM_MENU) { - Menu* zoom_menu = menu->AddSubMenu(insertion_index, IDC_ZOOM_MENU, - l10n_util::GetString(IDS_ZOOM_MENU)); + views::Menu* zoom_menu = + menu->AddSubMenu(insertion_index, IDC_ZOOM_MENU, + l10n_util::GetString(IDS_ZOOM_MENU)); zoom_menu->AppendMenuItemWithLabel( IDC_ZOOM_PLUS, l10n_util::GetString(IDS_ZOOM_PLUS)); diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index 40afbc5..c3e0734 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -25,10 +25,13 @@ class ExtensionShelf; class FullscreenExitBubble; class HtmlDialogUIDelegate; class InfoBarContainer; -class Menu; class StatusBubbleViews; class TabContentsContainerView; +namespace views { +class Menu; +} + /////////////////////////////////////////////////////////////////////////////// // BrowserView // @@ -316,7 +319,7 @@ class BrowserView : public BrowserWindow, void LoadAccelerators(); // Builds the correct menu for when we have minimal chrome. - void BuildMenuForTabStriplessWindow(Menu* menu, int insertion_index); + void BuildMenuForTabStriplessWindow(views::Menu* menu, int insertion_index); // Retrieves the command id for the specified Windows app command. int GetCommandIDForAppCommandID(int app_command_id) const; @@ -376,7 +379,7 @@ class BrowserView : public BrowserWindow, scoped_ptr<FullscreenExitBubble> fullscreen_bubble_; // Lazily created representation of the system menu. - scoped_ptr<Menu> system_menu_; + scoped_ptr<views::Menu> system_menu_; // The default favicon image. static SkBitmap default_favicon_; diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index 104cb34..5162b98 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -583,28 +583,28 @@ gfx::Size BrowserToolbarView::GetPreferredSize() { } void BrowserToolbarView::RunPageMenu(const gfx::Point& pt, HWND hwnd) { - Menu::AnchorPoint anchor = Menu::TOPRIGHT; + views::Menu::AnchorPoint anchor = views::Menu::TOPRIGHT; if (UILayoutIsRightToLeft()) - anchor = Menu::TOPLEFT; + anchor = views::Menu::TOPLEFT; - Menu menu(this, anchor, hwnd); - menu.AppendMenuItemWithLabel(IDC_CREATE_SHORTCUTS, + scoped_ptr<views::Menu> menu(views::Menu::Create(this, anchor, hwnd)); + menu->AppendMenuItemWithLabel(IDC_CREATE_SHORTCUTS, l10n_util::GetString(IDS_CREATE_SHORTCUTS)); - menu.AppendSeparator(); - menu.AppendMenuItemWithLabel(IDC_CUT, l10n_util::GetString(IDS_CUT)); - menu.AppendMenuItemWithLabel(IDC_COPY, l10n_util::GetString(IDS_COPY)); - menu.AppendMenuItemWithLabel(IDC_PASTE, l10n_util::GetString(IDS_PASTE)); - menu.AppendSeparator(); - - menu.AppendMenuItemWithLabel(IDC_FIND, - l10n_util::GetString(IDS_FIND)); - menu.AppendMenuItemWithLabel(IDC_SAVE_PAGE, - l10n_util::GetString(IDS_SAVE_PAGE)); - menu.AppendMenuItemWithLabel(IDC_PRINT, l10n_util::GetString(IDS_PRINT)); - menu.AppendSeparator(); - - Menu* zoom_menu = menu.AppendSubMenu(IDC_ZOOM_MENU, - l10n_util::GetString(IDS_ZOOM_MENU)); + menu->AppendSeparator(); + menu->AppendMenuItemWithLabel(IDC_CUT, l10n_util::GetString(IDS_CUT)); + menu->AppendMenuItemWithLabel(IDC_COPY, l10n_util::GetString(IDS_COPY)); + menu->AppendMenuItemWithLabel(IDC_PASTE, l10n_util::GetString(IDS_PASTE)); + menu->AppendSeparator(); + + menu->AppendMenuItemWithLabel(IDC_FIND, + l10n_util::GetString(IDS_FIND)); + menu->AppendMenuItemWithLabel(IDC_SAVE_PAGE, + l10n_util::GetString(IDS_SAVE_PAGE)); + menu->AppendMenuItemWithLabel(IDC_PRINT, l10n_util::GetString(IDS_PRINT)); + menu->AppendSeparator(); + + views::Menu* zoom_menu = menu->AppendSubMenu( + IDC_ZOOM_MENU, l10n_util::GetString(IDS_ZOOM_MENU)); zoom_menu->AppendMenuItemWithLabel(IDC_ZOOM_PLUS, l10n_util::GetString(IDS_ZOOM_PLUS)); zoom_menu->AppendMenuItemWithLabel(IDC_ZOOM_NORMAL, @@ -613,7 +613,7 @@ void BrowserToolbarView::RunPageMenu(const gfx::Point& pt, HWND hwnd) { l10n_util::GetString(IDS_ZOOM_MINUS)); // Create encoding menu. - Menu* encoding_menu = menu.AppendSubMenu( + views::Menu* encoding_menu = menu->AppendSubMenu( IDC_ENCODING_MENU, l10n_util::GetString(IDS_ENCODING_MENU)); EncodingMenuControllerDelegate::BuildEncodingMenu(profile_, encoding_menu); @@ -629,8 +629,8 @@ void BrowserToolbarView::RunPageMenu(const gfx::Point& pt, HWND hwnd) { { IDC_TASK_MANAGER, IDS_TASK_MANAGER } }; // Append developer menu. - menu.AppendSeparator(); - Menu* developer_menu = menu.AppendSubMenu(IDC_DEVELOPER_MENU, + menu->AppendSeparator(); + views::Menu* developer_menu = menu->AppendSubMenu(IDC_DEVELOPER_MENU, l10n_util::GetString(IDS_DEVELOPER_MENU)); for (int i = 0; i < arraysize(developer_menu_materials); ++i) { if (developer_menu_materials[i].menu_id) { @@ -642,24 +642,24 @@ void BrowserToolbarView::RunPageMenu(const gfx::Point& pt, HWND hwnd) { } } - menu.AppendSeparator(); + menu->AppendSeparator(); - menu.AppendMenuItemWithLabel(IDC_REPORT_BUG, + menu->AppendMenuItemWithLabel(IDC_REPORT_BUG, l10n_util::GetString(IDS_REPORT_BUG)); - menu.RunMenuAt(pt.x(), pt.y()); + menu->RunMenuAt(pt.x(), pt.y()); } void BrowserToolbarView::RunAppMenu(const gfx::Point& pt, HWND hwnd) { - Menu::AnchorPoint anchor = Menu::TOPRIGHT; + views::Menu::AnchorPoint anchor = views::Menu::TOPRIGHT; if (UILayoutIsRightToLeft()) - anchor = Menu::TOPLEFT; + anchor = views::Menu::TOPLEFT; - Menu menu(this, anchor, hwnd); - menu.AppendMenuItemWithLabel(IDC_NEW_TAB, l10n_util::GetString(IDS_NEW_TAB)); - menu.AppendMenuItemWithLabel(IDC_NEW_WINDOW, - l10n_util::GetString(IDS_NEW_WINDOW)); - menu.AppendMenuItemWithLabel(IDC_NEW_INCOGNITO_WINDOW, - l10n_util::GetString(IDS_NEW_INCOGNITO_WINDOW)); + scoped_ptr<views::Menu> menu(views::Menu::Create(this, anchor, hwnd)); + menu->AppendMenuItemWithLabel(IDC_NEW_TAB, l10n_util::GetString(IDS_NEW_TAB)); + menu->AppendMenuItemWithLabel(IDC_NEW_WINDOW, + l10n_util::GetString(IDS_NEW_WINDOW)); + menu->AppendMenuItemWithLabel(IDC_NEW_INCOGNITO_WINDOW, + l10n_util::GetString(IDS_NEW_INCOGNITO_WINDOW)); // Enumerate profiles asynchronously and then create the parent menu item. // We will create the child menu items for this once the asynchronous call is @@ -667,44 +667,44 @@ void BrowserToolbarView::RunAppMenu(const gfx::Point& pt, HWND hwnd) { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kEnableUserDataDirProfiles)) { profiles_helper_->GetProfiles(NULL); - profiles_menu_ = menu.AppendSubMenu(IDC_PROFILE_MENU, - l10n_util::GetString(IDS_PROFILE_MENU)); + profiles_menu_ = menu->AppendSubMenu( + IDC_PROFILE_MENU, l10n_util::GetString(IDS_PROFILE_MENU)); } - menu.AppendSeparator(); - menu.AppendMenuItemWithLabel(IDC_SHOW_BOOKMARK_BAR, - l10n_util::GetString(IDS_SHOW_BOOKMARK_BAR)); - menu.AppendMenuItemWithLabel(IDC_FULLSCREEN, - l10n_util::GetString(IDS_FULLSCREEN)); - menu.AppendSeparator(); - menu.AppendMenuItemWithLabel(IDC_SHOW_HISTORY, - l10n_util::GetString(IDS_SHOW_HISTORY)); - menu.AppendMenuItemWithLabel(IDC_SHOW_BOOKMARK_MANAGER, - l10n_util::GetString(IDS_BOOKMARK_MANAGER)); - menu.AppendMenuItemWithLabel(IDC_SHOW_DOWNLOADS, - l10n_util::GetString(IDS_SHOW_DOWNLOADS)); - menu.AppendSeparator(); + menu->AppendSeparator(); + menu->AppendMenuItemWithLabel(IDC_SHOW_BOOKMARK_BAR, + l10n_util::GetString(IDS_SHOW_BOOKMARK_BAR)); + menu->AppendMenuItemWithLabel(IDC_FULLSCREEN, + l10n_util::GetString(IDS_FULLSCREEN)); + menu->AppendSeparator(); + menu->AppendMenuItemWithLabel(IDC_SHOW_HISTORY, + l10n_util::GetString(IDS_SHOW_HISTORY)); + menu->AppendMenuItemWithLabel(IDC_SHOW_BOOKMARK_MANAGER, + l10n_util::GetString(IDS_BOOKMARK_MANAGER)); + menu->AppendMenuItemWithLabel(IDC_SHOW_DOWNLOADS, + l10n_util::GetString(IDS_SHOW_DOWNLOADS)); + menu->AppendSeparator(); #ifdef CHROME_PERSONALIZATION if (!Personalization::IsP13NDisabled()) { - menu.AppendMenuItemWithLabel(IDC_P13N_INFO, + menu->AppendMenuItemWithLabel(IDC_P13N_INFO, Personalization::GetMenuItemInfoText(browser())); } #endif - menu.AppendMenuItemWithLabel(IDC_CLEAR_BROWSING_DATA, - l10n_util::GetString(IDS_CLEAR_BROWSING_DATA)); - menu.AppendMenuItemWithLabel(IDC_IMPORT_SETTINGS, - l10n_util::GetString(IDS_IMPORT_SETTINGS)); - menu.AppendSeparator(); - menu.AppendMenuItemWithLabel(IDC_OPTIONS, l10n_util::GetStringF(IDS_OPTIONS, - l10n_util::GetString(IDS_PRODUCT_NAME))); - menu.AppendMenuItemWithLabel(IDC_ABOUT, l10n_util::GetStringF(IDS_ABOUT, - l10n_util::GetString(IDS_PRODUCT_NAME))); - menu.AppendMenuItemWithLabel(IDC_HELP_PAGE, - l10n_util::GetString(IDS_HELP_PAGE)); - menu.AppendSeparator(); - menu.AppendMenuItemWithLabel(IDC_EXIT, l10n_util::GetString(IDS_EXIT)); - - menu.RunMenuAt(pt.x(), pt.y()); + menu->AppendMenuItemWithLabel(IDC_CLEAR_BROWSING_DATA, + l10n_util::GetString(IDS_CLEAR_BROWSING_DATA)); + menu->AppendMenuItemWithLabel(IDC_IMPORT_SETTINGS, + l10n_util::GetString(IDS_IMPORT_SETTINGS)); + menu->AppendSeparator(); + menu->AppendMenuItemWithLabel(IDC_OPTIONS, l10n_util::GetStringF(IDS_OPTIONS, + l10n_util::GetString(IDS_PRODUCT_NAME))); + menu->AppendMenuItemWithLabel(IDC_ABOUT, l10n_util::GetStringF(IDS_ABOUT, + l10n_util::GetString(IDS_PRODUCT_NAME))); + menu->AppendMenuItemWithLabel(IDC_HELP_PAGE, + l10n_util::GetString(IDS_HELP_PAGE)); + menu->AppendSeparator(); + menu->AppendMenuItemWithLabel(IDC_EXIT, l10n_util::GetString(IDS_EXIT)); + + menu->RunMenuAt(pt.x(), pt.y()); // Menu is going away, so set the profiles menu pointer to NULL. profiles_menu_ = NULL; diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h index ad373d4..64feb34 100644 --- a/chrome/browser/views/toolbar_view.h +++ b/chrome/browser/views/toolbar_view.h @@ -202,7 +202,7 @@ class BrowserToolbarView : public views::View, TabContents* tab_; // Profiles menu to populate with profile names. - Menu* profiles_menu_; + views::Menu* profiles_menu_; // Helper class to enumerate profiles information on the file thread. scoped_refptr<GetProfilesHelper> profiles_helper_; |