| 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/i18n/number_formatting.h" | 10 #include "base/i18n/number_formatting.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/ui/browser_window.h" | 26 #include "chrome/browser/ui/browser_window.h" |
| 27 #include "chrome/browser/ui/global_error/global_error_service.h" | 27 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 28 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 28 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 29 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 29 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 30 #include "chrome/browser/ui/view_ids.h" | 30 #include "chrome/browser/ui/view_ids.h" |
| 31 #include "chrome/browser/ui/views/extensions/extension_popup.h" | 31 #include "chrome/browser/ui/views/extensions/extension_popup.h" |
| 32 #include "chrome/browser/ui/views/frame/browser_view.h" | 32 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 33 #include "chrome/browser/ui/views/layout_constants.h" | 33 #include "chrome/browser/ui/views/layout_constants.h" |
| 34 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" | 34 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" |
| 35 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" | 35 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" |
| 36 #include "chrome/browser/ui/views/location_bar/save_credit_card_icon_view.h" |
| 36 #include "chrome/browser/ui/views/location_bar/star_view.h" | 37 #include "chrome/browser/ui/views/location_bar/star_view.h" |
| 37 #include "chrome/browser/ui/views/location_bar/translate_icon_view.h" | 38 #include "chrome/browser/ui/views/location_bar/translate_icon_view.h" |
| 38 #include "chrome/browser/ui/views/outdated_upgrade_bubble_view.h" | 39 #include "chrome/browser/ui/views/outdated_upgrade_bubble_view.h" |
| 39 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" | 40 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" |
| 40 #include "chrome/browser/ui/views/toolbar/back_button.h" | 41 #include "chrome/browser/ui/views/toolbar/back_button.h" |
| 41 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 42 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
| 42 #include "chrome/browser/ui/views/toolbar/home_button.h" | 43 #include "chrome/browser/ui/views/toolbar/home_button.h" |
| 43 #include "chrome/browser/ui/views/toolbar/reload_button.h" | 44 #include "chrome/browser/ui/views/toolbar/reload_button.h" |
| 44 #include "chrome/browser/ui/views/toolbar/toolbar_button.h" | 45 #include "chrome/browser/ui/views/toolbar/toolbar_button.h" |
| 45 #include "chrome/common/chrome_switches.h" | 46 #include "chrome/common/chrome_switches.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 302 |
| 302 bool ToolbarView::IsAppMenuFocused() { | 303 bool ToolbarView::IsAppMenuFocused() { |
| 303 return app_menu_button_->HasFocus(); | 304 return app_menu_button_->HasFocus(); |
| 304 } | 305 } |
| 305 | 306 |
| 306 views::View* ToolbarView::GetBookmarkBubbleAnchor() { | 307 views::View* ToolbarView::GetBookmarkBubbleAnchor() { |
| 307 views::View* star_view = location_bar()->star_view(); | 308 views::View* star_view = location_bar()->star_view(); |
| 308 return (star_view && star_view->visible()) ? star_view : app_menu_button_; | 309 return (star_view && star_view->visible()) ? star_view : app_menu_button_; |
| 309 } | 310 } |
| 310 | 311 |
| 312 views::View* ToolbarView::GetSaveCreditCardBubbleAnchor() { |
| 313 views::View* save_credit_card_icon_view = |
| 314 location_bar()->save_credit_card_icon_view(); |
| 315 return (save_credit_card_icon_view && save_credit_card_icon_view->visible()) |
| 316 ? save_credit_card_icon_view |
| 317 : app_menu_button_; |
| 318 } |
| 319 |
| 311 views::View* ToolbarView::GetTranslateBubbleAnchor() { | 320 views::View* ToolbarView::GetTranslateBubbleAnchor() { |
| 312 views::View* translate_icon_view = location_bar()->translate_icon_view(); | 321 views::View* translate_icon_view = location_bar()->translate_icon_view(); |
| 313 return (translate_icon_view && translate_icon_view->visible()) | 322 return (translate_icon_view && translate_icon_view->visible()) |
| 314 ? translate_icon_view | 323 ? translate_icon_view |
| 315 : app_menu_button_; | 324 : app_menu_button_; |
| 316 } | 325 } |
| 317 | 326 |
| 318 void ToolbarView::ExecuteExtensionCommand( | 327 void ToolbarView::ExecuteExtensionCommand( |
| 319 const extensions::Extension* extension, | 328 const extensions::Extension* extension, |
| 320 const extensions::Command& command) { | 329 const extensions::Command& command) { |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 void ToolbarView::OnShowHomeButtonChanged() { | 838 void ToolbarView::OnShowHomeButtonChanged() { |
| 830 Layout(); | 839 Layout(); |
| 831 SchedulePaint(); | 840 SchedulePaint(); |
| 832 } | 841 } |
| 833 | 842 |
| 834 int ToolbarView::content_shadow_height() const { | 843 int ToolbarView::content_shadow_height() const { |
| 835 return GetLayoutConstant( | 844 return GetLayoutConstant( |
| 836 (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) ? | 845 (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) ? |
| 837 TOOLBAR_CONTENT_SHADOW_HEIGHT_ASH : TOOLBAR_CONTENT_SHADOW_HEIGHT); | 846 TOOLBAR_CONTENT_SHADOW_HEIGHT_ASH : TOOLBAR_CONTENT_SHADOW_HEIGHT); |
| 838 } | 847 } |
| OLD | NEW |