| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/views/toolbar_view.h" | 5 #include "chrome/browser/views/toolbar_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "app/drag_drop_types.h" | 9 #include "app/drag_drop_types.h" |
| 10 #include "app/gfx/canvas.h" | 10 #include "app/gfx/canvas.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 //////////////////////////////////////////////////////////////////////////////// | 245 //////////////////////////////////////////////////////////////////////////////// |
| 246 // ToolbarView, Menu::BaseControllerDelegate overrides: | 246 // ToolbarView, Menu::BaseControllerDelegate overrides: |
| 247 | 247 |
| 248 bool ToolbarView::GetAcceleratorInfo(int id, views::Accelerator* accel) { | 248 bool ToolbarView::GetAcceleratorInfo(int id, views::Accelerator* accel) { |
| 249 return GetWidget()->GetAccelerator(id, accel); | 249 return GetWidget()->GetAccelerator(id, accel); |
| 250 } | 250 } |
| 251 | 251 |
| 252 //////////////////////////////////////////////////////////////////////////////// | 252 //////////////////////////////////////////////////////////////////////////////// |
| 253 // ToolbarView, views::MenuDelegate implementation: | 253 // ToolbarView, views::MenuDelegate implementation: |
| 254 | 254 |
| 255 void ToolbarView::RunMenu(views::View* source, const gfx::Point& pt, | 255 void ToolbarView::RunMenu(views::View* source, const gfx::Point& pt) { |
| 256 gfx::NativeView parent) { | |
| 257 switch (source->GetID()) { | 256 switch (source->GetID()) { |
| 258 case VIEW_ID_PAGE_MENU: | 257 case VIEW_ID_PAGE_MENU: |
| 259 RunPageMenu(pt, parent); | 258 RunPageMenu(pt); |
| 260 break; | 259 break; |
| 261 case VIEW_ID_APP_MENU: | 260 case VIEW_ID_APP_MENU: |
| 262 RunAppMenu(pt, parent); | 261 RunAppMenu(pt); |
| 263 break; | 262 break; |
| 264 default: | 263 default: |
| 265 NOTREACHED() << "Invalid source menu."; | 264 NOTREACHED() << "Invalid source menu."; |
| 266 } | 265 } |
| 267 } | 266 } |
| 268 | 267 |
| 269 //////////////////////////////////////////////////////////////////////////////// | 268 //////////////////////////////////////////////////////////////////////////////// |
| 270 // ToolbarView, GetProfilesHelper::Delegate implementation: | 269 // ToolbarView, GetProfilesHelper::Delegate implementation: |
| 271 | 270 |
| 272 void ToolbarView::OnGetProfilesDone( | 271 void ToolbarView::OnGetProfilesDone( |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 page_menu_->SetIcon(*tp->GetBitmapNamed(IDR_MENU_PAGE)); | 989 page_menu_->SetIcon(*tp->GetBitmapNamed(IDR_MENU_PAGE)); |
| 991 if (UILayoutIsRightToLeft()) | 990 if (UILayoutIsRightToLeft()) |
| 992 app_menu_->SetIcon(*tp->GetBitmapNamed(IDR_MENU_CHROME_RTL)); | 991 app_menu_->SetIcon(*tp->GetBitmapNamed(IDR_MENU_CHROME_RTL)); |
| 993 else | 992 else |
| 994 app_menu_->SetIcon(*tp->GetBitmapNamed(IDR_MENU_CHROME)); | 993 app_menu_->SetIcon(*tp->GetBitmapNamed(IDR_MENU_CHROME)); |
| 995 | 994 |
| 996 if (bookmark_menu_ != NULL) | 995 if (bookmark_menu_ != NULL) |
| 997 bookmark_menu_->SetIcon(*tp->GetBitmapNamed(IDR_MENU_BOOKMARK)); | 996 bookmark_menu_->SetIcon(*tp->GetBitmapNamed(IDR_MENU_BOOKMARK)); |
| 998 } | 997 } |
| 999 | 998 |
| 1000 void ToolbarView::RunPageMenu(const gfx::Point& pt, gfx::NativeView parent) { | 999 void ToolbarView::RunPageMenu(const gfx::Point& pt) { |
| 1001 CreatePageMenu(); | 1000 CreatePageMenu(); |
| 1002 page_menu_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPRIGHT); | 1001 page_menu_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPRIGHT); |
| 1003 } | 1002 } |
| 1004 | 1003 |
| 1005 void ToolbarView::RunAppMenu(const gfx::Point& pt, gfx::NativeView parent) { | 1004 void ToolbarView::RunAppMenu(const gfx::Point& pt) { |
| 1006 CreateAppMenu(); | 1005 CreateAppMenu(); |
| 1007 app_menu_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPRIGHT); | 1006 app_menu_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPRIGHT); |
| 1008 } | 1007 } |
| 1009 | 1008 |
| 1010 void ToolbarView::CreatePageMenu() { | 1009 void ToolbarView::CreatePageMenu() { |
| 1011 if (page_menu_contents_.get()) | 1010 if (page_menu_contents_.get()) |
| 1012 return; | 1011 return; |
| 1013 | 1012 |
| 1014 page_menu_contents_.reset(new views::SimpleMenuModel(this)); | 1013 page_menu_contents_.reset(new views::SimpleMenuModel(this)); |
| 1015 page_menu_contents_->AddItemWithStringId(IDC_CREATE_SHORTCUTS, | 1014 page_menu_contents_->AddItemWithStringId(IDC_CREATE_SHORTCUTS, |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 app_menu_contents_->AddItem(IDC_ABOUT, | 1150 app_menu_contents_->AddItem(IDC_ABOUT, |
| 1152 l10n_util::GetStringFUTF16( | 1151 l10n_util::GetStringFUTF16( |
| 1153 IDS_ABOUT, | 1152 IDS_ABOUT, |
| 1154 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); | 1153 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); |
| 1155 app_menu_contents_->AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE); | 1154 app_menu_contents_->AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE); |
| 1156 app_menu_contents_->AddSeparator(); | 1155 app_menu_contents_->AddSeparator(); |
| 1157 app_menu_contents_->AddItemWithStringId(IDC_EXIT, IDS_EXIT); | 1156 app_menu_contents_->AddItemWithStringId(IDC_EXIT, IDS_EXIT); |
| 1158 | 1157 |
| 1159 app_menu_menu_.reset(new views::Menu2(app_menu_contents_.get())); | 1158 app_menu_menu_.reset(new views::Menu2(app_menu_contents_.get())); |
| 1160 } | 1159 } |
| OLD | NEW |