| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/views/toolbar/toolbar_view.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "base/i18n/number_formatting.h" | 11 #include "base/i18n/number_formatting.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/command_updater.h" | 16 #include "chrome/browser/command_updater.h" |
| 17 #include "chrome/browser/extensions/extension_action.h" | |
| 18 #include "chrome/browser/extensions/extension_action_manager.h" | |
| 19 #include "chrome/browser/extensions/extension_util.h" | 17 #include "chrome/browser/extensions/extension_util.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/themes/theme_service.h" | 19 #include "chrome/browser/themes/theme_service.h" |
| 22 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| 23 #include "chrome/browser/ui/browser_command_controller.h" | 21 #include "chrome/browser/ui/browser_command_controller.h" |
| 24 #include "chrome/browser/ui/browser_commands.h" | 22 #include "chrome/browser/ui/browser_commands.h" |
| 25 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" | 23 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" |
| 26 #include "chrome/browser/ui/browser_instant_controller.h" | 24 #include "chrome/browser/ui/browser_instant_controller.h" |
| 27 #include "chrome/browser/ui/browser_tabstrip.h" | 25 #include "chrome/browser/ui/browser_tabstrip.h" |
| 28 #include "chrome/browser/ui/browser_window.h" | 26 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 return (translate_icon_view && translate_icon_view->visible()) ? | 310 return (translate_icon_view && translate_icon_view->visible()) ? |
| 313 translate_icon_view : app_menu_; | 311 translate_icon_view : app_menu_; |
| 314 } | 312 } |
| 315 | 313 |
| 316 void ToolbarView::ExecuteExtensionCommand( | 314 void ToolbarView::ExecuteExtensionCommand( |
| 317 const extensions::Extension* extension, | 315 const extensions::Extension* extension, |
| 318 const extensions::Command& command) { | 316 const extensions::Command& command) { |
| 319 browser_actions_->ExecuteExtensionCommand(extension, command); | 317 browser_actions_->ExecuteExtensionCommand(extension, command); |
| 320 } | 318 } |
| 321 | 319 |
| 322 void ToolbarView::ShowPageActionPopup(const extensions::Extension* extension) { | |
| 323 extensions::ExtensionActionManager* extension_manager = | |
| 324 extensions::ExtensionActionManager::Get(browser_->profile()); | |
| 325 ExtensionAction* extension_action = | |
| 326 extension_manager->GetPageAction(*extension); | |
| 327 if (extension_action) { | |
| 328 location_bar_->GetPageActionView(extension_action)->image_view()-> | |
| 329 view_controller()->ExecuteAction(ExtensionPopup::SHOW, false); | |
| 330 } | |
| 331 } | |
| 332 | |
| 333 void ToolbarView::ShowBrowserActionPopup( | |
| 334 const extensions::Extension* extension) { | |
| 335 browser_actions_->ShowPopupForExtension(extension, true, false); | |
| 336 } | |
| 337 | |
| 338 void ToolbarView::ShowAppMenu(bool for_drop) { | 320 void ToolbarView::ShowAppMenu(bool for_drop) { |
| 339 if (wrench_menu_.get() && wrench_menu_->IsShowing()) | 321 if (wrench_menu_.get() && wrench_menu_->IsShowing()) |
| 340 return; | 322 return; |
| 341 | 323 |
| 342 if (keyboard::KeyboardController::GetInstance() && | 324 if (keyboard::KeyboardController::GetInstance() && |
| 343 keyboard::KeyboardController::GetInstance()->keyboard_visible()) { | 325 keyboard::KeyboardController::GetInstance()->keyboard_visible()) { |
| 344 keyboard::KeyboardController::GetInstance()->HideKeyboard( | 326 keyboard::KeyboardController::GetInstance()->HideKeyboard( |
| 345 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC); | 327 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC); |
| 346 } | 328 } |
| 347 | 329 |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 | 766 |
| 785 void ToolbarView::OnShowHomeButtonChanged() { | 767 void ToolbarView::OnShowHomeButtonChanged() { |
| 786 Layout(); | 768 Layout(); |
| 787 SchedulePaint(); | 769 SchedulePaint(); |
| 788 } | 770 } |
| 789 | 771 |
| 790 int ToolbarView::content_shadow_height() const { | 772 int ToolbarView::content_shadow_height() const { |
| 791 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? | 773 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? |
| 792 kContentShadowHeightAsh : kContentShadowHeight; | 774 kContentShadowHeightAsh : kContentShadowHeight; |
| 793 } | 775 } |
| OLD | NEW |