Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_view.h" | 5 #include "chrome/browser/ui/views/toolbar_view.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/i18n/number_formatting.h" | 8 #include "base/i18n/number_formatting.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 24 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 25 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 25 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 26 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 26 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 27 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" | 27 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
| 28 #include "chrome/browser/ui/view_ids.h" | 28 #include "chrome/browser/ui/view_ids.h" |
| 29 #include "chrome/browser/ui/views/browser_actions_container.h" | 29 #include "chrome/browser/ui/views/browser_actions_container.h" |
| 30 #include "chrome/browser/ui/views/frame/browser_view.h" | 30 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 31 #include "chrome/browser/ui/views/home_button.h" | 31 #include "chrome/browser/ui/views/home_button.h" |
| 32 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" | 32 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" |
| 33 #include "chrome/browser/ui/views/location_bar/star_view.h" | 33 #include "chrome/browser/ui/views/location_bar/star_view.h" |
| 34 #include "chrome/browser/ui/views/location_bar/translate_icon_view.h" | |
| 34 #include "chrome/browser/ui/views/outdated_upgrade_bubble_view.h" | 35 #include "chrome/browser/ui/views/outdated_upgrade_bubble_view.h" |
| 35 #include "chrome/browser/ui/views/wrench_menu.h" | 36 #include "chrome/browser/ui/views/wrench_menu.h" |
| 36 #include "chrome/browser/ui/views/wrench_toolbar_button.h" | 37 #include "chrome/browser/ui/views/wrench_toolbar_button.h" |
| 37 #include "chrome/browser/upgrade_detector.h" | 38 #include "chrome/browser/upgrade_detector.h" |
| 38 #include "chrome/common/pref_names.h" | 39 #include "chrome/common/pref_names.h" |
| 39 #include "content/public/browser/browser_accessibility_state.h" | 40 #include "content/public/browser/browser_accessibility_state.h" |
| 40 #include "content/public/browser/notification_service.h" | 41 #include "content/public/browser/notification_service.h" |
| 41 #include "content/public/browser/render_view_host.h" | 42 #include "content/public/browser/render_view_host.h" |
| 42 #include "content/public/browser/user_metrics.h" | 43 #include "content/public/browser/user_metrics.h" |
| 43 #include "content/public/browser/web_contents.h" | 44 #include "content/public/browser/web_contents.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 menu_listeners_.RemoveObserver(listener); | 277 menu_listeners_.RemoveObserver(listener); |
| 277 } | 278 } |
| 278 | 279 |
| 279 views::View* ToolbarView::GetBookmarkBubbleAnchor() { | 280 views::View* ToolbarView::GetBookmarkBubbleAnchor() { |
| 280 views::View* star_view = location_bar()->star_view(); | 281 views::View* star_view = location_bar()->star_view(); |
| 281 if (star_view && star_view->visible()) | 282 if (star_view && star_view->visible()) |
| 282 return star_view; | 283 return star_view; |
| 283 return app_menu_; | 284 return app_menu_; |
| 284 } | 285 } |
| 285 | 286 |
| 287 views::View* ToolbarView::GetTranslateBubbleAnchor() { | |
| 288 views::View* translate_icon_view = location_bar()->translate_icon_view(); | |
| 289 DCHECK(translate_icon_view); | |
|
Takashi Toyoshima
2013/10/08 14:54:09
Did you check if this DCHECK is correct?
hajimehoshi
2013/10/10 11:07:10
Ah, this could be called before LocationBarView's
| |
| 290 return translate_icon_view; | |
| 291 } | |
| 292 | |
| 286 views::MenuButton* ToolbarView::app_menu() const { | 293 views::MenuButton* ToolbarView::app_menu() const { |
| 287 return app_menu_; | 294 return app_menu_; |
| 288 } | 295 } |
| 289 | 296 |
| 290 //////////////////////////////////////////////////////////////////////////////// | 297 //////////////////////////////////////////////////////////////////////////////// |
| 291 // ToolbarView, AccessiblePaneView overrides: | 298 // ToolbarView, AccessiblePaneView overrides: |
| 292 | 299 |
| 293 bool ToolbarView::SetPaneFocus(views::View* initial_focus) { | 300 bool ToolbarView::SetPaneFocus(views::View* initial_focus) { |
| 294 if (!AccessiblePaneView::SetPaneFocus(initial_focus)) | 301 if (!AccessiblePaneView::SetPaneFocus(initial_focus)) |
| 295 return false; | 302 return false; |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 785 | 792 |
| 786 void ToolbarView::OnShowHomeButtonChanged() { | 793 void ToolbarView::OnShowHomeButtonChanged() { |
| 787 Layout(); | 794 Layout(); |
| 788 SchedulePaint(); | 795 SchedulePaint(); |
| 789 } | 796 } |
| 790 | 797 |
| 791 int ToolbarView::content_shadow_height() const { | 798 int ToolbarView::content_shadow_height() const { |
| 792 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? | 799 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? |
| 793 kContentShadowHeightAsh : kContentShadowHeight; | 800 kContentShadowHeightAsh : kContentShadowHeight; |
| 794 } | 801 } |
| OLD | NEW |