| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "chrome/grit/generated_resources.h" | 54 #include "chrome/grit/generated_resources.h" |
| 55 #include "components/bookmarks/common/bookmark_pref_names.h" | 55 #include "components/bookmarks/common/bookmark_pref_names.h" |
| 56 #include "components/favicon/content/content_favicon_driver.h" | 56 #include "components/favicon/content/content_favicon_driver.h" |
| 57 #include "components/omnibox/browser/omnibox_popup_model.h" | 57 #include "components/omnibox/browser/omnibox_popup_model.h" |
| 58 #include "components/omnibox/browser/omnibox_popup_view.h" | 58 #include "components/omnibox/browser/omnibox_popup_view.h" |
| 59 #include "components/prefs/pref_service.h" | 59 #include "components/prefs/pref_service.h" |
| 60 #include "components/search_engines/template_url.h" | 60 #include "components/search_engines/template_url.h" |
| 61 #include "components/search_engines/template_url_service.h" | 61 #include "components/search_engines/template_url_service.h" |
| 62 #include "components/toolbar/toolbar_model.h" | 62 #include "components/toolbar/toolbar_model.h" |
| 63 #include "components/translate/core/browser/language_state.h" | 63 #include "components/translate/core/browser/language_state.h" |
| 64 #include "components/ui/zoom/zoom_controller.h" | 64 #include "components/zoom/zoom_controller.h" |
| 65 #include "components/ui/zoom/zoom_event_manager.h" | 65 #include "components/zoom/zoom_event_manager.h" |
| 66 #include "content/public/browser/render_widget_host_view.h" | 66 #include "content/public/browser/render_widget_host_view.h" |
| 67 #include "content/public/browser/web_contents.h" | 67 #include "content/public/browser/web_contents.h" |
| 68 #include "extensions/browser/extension_registry.h" | 68 #include "extensions/browser/extension_registry.h" |
| 69 #include "extensions/common/feature_switch.h" | 69 #include "extensions/common/feature_switch.h" |
| 70 #include "grit/components_scaled_resources.h" | 70 #include "grit/components_scaled_resources.h" |
| 71 #include "grit/theme_resources.h" | 71 #include "grit/theme_resources.h" |
| 72 #include "ui/accessibility/ax_view_state.h" | 72 #include "ui/accessibility/ax_view_state.h" |
| 73 #include "ui/base/dragdrop/drag_drop_types.h" | 73 #include "ui/base/dragdrop/drag_drop_types.h" |
| 74 #include "ui/base/material_design/material_design_controller.h" | 74 #include "ui/base/material_design/material_design_controller.h" |
| 75 #include "ui/base/resource/resource_bundle.h" | 75 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 size_animation_(this), | 146 size_animation_(this), |
| 147 is_popup_mode_(is_popup_mode), | 147 is_popup_mode_(is_popup_mode), |
| 148 show_focus_rect_(false), | 148 show_focus_rect_(false), |
| 149 template_url_service_(NULL), | 149 template_url_service_(NULL), |
| 150 web_contents_null_at_last_refresh_(true) { | 150 web_contents_null_at_last_refresh_(true) { |
| 151 edit_bookmarks_enabled_.Init( | 151 edit_bookmarks_enabled_.Init( |
| 152 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(), | 152 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(), |
| 153 base::Bind(&LocationBarView::UpdateWithoutTabRestore, | 153 base::Bind(&LocationBarView::UpdateWithoutTabRestore, |
| 154 base::Unretained(this))); | 154 base::Unretained(this))); |
| 155 | 155 |
| 156 ui_zoom::ZoomEventManager::GetForBrowserContext(profile) | 156 zoom::ZoomEventManager::GetForBrowserContext(profile) |
| 157 ->AddZoomEventManagerObserver(this); | 157 ->AddZoomEventManagerObserver(this); |
| 158 } | 158 } |
| 159 | 159 |
| 160 LocationBarView::~LocationBarView() { | 160 LocationBarView::~LocationBarView() { |
| 161 if (template_url_service_) | 161 if (template_url_service_) |
| 162 template_url_service_->RemoveObserver(this); | 162 template_url_service_->RemoveObserver(this); |
| 163 | 163 |
| 164 ui_zoom::ZoomEventManager::GetForBrowserContext(profile()) | 164 zoom::ZoomEventManager::GetForBrowserContext(profile()) |
| 165 ->RemoveZoomEventManagerObserver(this); | 165 ->RemoveZoomEventManagerObserver(this); |
| 166 } | 166 } |
| 167 | 167 |
| 168 //////////////////////////////////////////////////////////////////////////////// | 168 //////////////////////////////////////////////////////////////////////////////// |
| 169 // LocationBarView, public: | 169 // LocationBarView, public: |
| 170 | 170 |
| 171 // static | 171 // static |
| 172 SkColor LocationBarView::GetBorderColor(bool incognito) { | 172 SkColor LocationBarView::GetBorderColor(bool incognito) { |
| 173 return color_utils::AlphaBlend( | 173 return color_utils::AlphaBlend( |
| 174 SkColorSetA(kBorderColor, SK_AlphaOPAQUE), | 174 SkColorSetA(kBorderColor, SK_AlphaOPAQUE), |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 | 967 |
| 968 return false; | 968 return false; |
| 969 } | 969 } |
| 970 | 970 |
| 971 bool LocationBarView::RefreshZoomView() { | 971 bool LocationBarView::RefreshZoomView() { |
| 972 DCHECK(zoom_view_); | 972 DCHECK(zoom_view_); |
| 973 WebContents* web_contents = GetWebContents(); | 973 WebContents* web_contents = GetWebContents(); |
| 974 if (!web_contents) | 974 if (!web_contents) |
| 975 return false; | 975 return false; |
| 976 const bool was_visible = zoom_view_->visible(); | 976 const bool was_visible = zoom_view_->visible(); |
| 977 zoom_view_->Update(ui_zoom::ZoomController::FromWebContents(web_contents)); | 977 zoom_view_->Update(zoom::ZoomController::FromWebContents(web_contents)); |
| 978 if (!zoom_view_->visible()) | 978 if (!zoom_view_->visible()) |
| 979 ZoomBubbleView::CloseCurrentBubble(); | 979 ZoomBubbleView::CloseCurrentBubble(); |
| 980 return was_visible != zoom_view_->visible(); | 980 return was_visible != zoom_view_->visible(); |
| 981 } | 981 } |
| 982 | 982 |
| 983 void LocationBarView::OnDefaultZoomLevelChanged() { | 983 void LocationBarView::OnDefaultZoomLevelChanged() { |
| 984 RefreshZoomView(); | 984 RefreshZoomView(); |
| 985 } | 985 } |
| 986 | 986 |
| 987 bool LocationBarView::RefreshSaveCreditCardIconView() { | 987 bool LocationBarView::RefreshSaveCreditCardIconView() { |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1389 // LocationBarView, private TemplateURLServiceObserver implementation: | 1389 // LocationBarView, private TemplateURLServiceObserver implementation: |
| 1390 | 1390 |
| 1391 void LocationBarView::OnTemplateURLServiceChanged() { | 1391 void LocationBarView::OnTemplateURLServiceChanged() { |
| 1392 template_url_service_->RemoveObserver(this); | 1392 template_url_service_->RemoveObserver(this); |
| 1393 template_url_service_ = nullptr; | 1393 template_url_service_ = nullptr; |
| 1394 // If the browser is no longer active, let's not show the info bubble, as this | 1394 // If the browser is no longer active, let's not show the info bubble, as this |
| 1395 // would make the browser the active window again. | 1395 // would make the browser the active window again. |
| 1396 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1396 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
| 1397 ShowFirstRunBubble(); | 1397 ShowFirstRunBubble(); |
| 1398 } | 1398 } |
| OLD | NEW |