| 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" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
| 16 #include "chrome/browser/command_updater.h" | 16 #include "chrome/browser/command_updater.h" |
| 17 #include "chrome/browser/defaults.h" | 17 #include "chrome/browser/defaults.h" |
| 18 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" | 18 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" |
| 19 #include "chrome/browser/extensions/extension_action.h" | 19 #include "chrome/browser/extensions/extension_action.h" |
| 20 #include "chrome/browser/extensions/extension_action_manager.h" | 20 #include "chrome/browser/extensions/extension_action_manager.h" |
| 21 #include "chrome/browser/extensions/extension_util.h" | 21 #include "chrome/browser/extensions/extension_util.h" |
| 22 #include "chrome/browser/extensions/location_bar_controller.h" | 22 #include "chrome/browser/extensions/location_bar_controller.h" |
| 23 #include "chrome/browser/extensions/tab_helper.h" | 23 #include "chrome/browser/extensions/tab_helper.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/search/instant_service.h" | |
| 26 #include "chrome/browser/search/instant_service_factory.h" | |
| 27 #include "chrome/browser/search/search.h" | |
| 28 #include "chrome/browser/search_engines/template_url_service_factory.h" | 25 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 29 #include "chrome/browser/translate/chrome_translate_client.h" | 26 #include "chrome/browser/translate/chrome_translate_client.h" |
| 30 #include "chrome/browser/translate/translate_service.h" | 27 #include "chrome/browser/translate/translate_service.h" |
| 31 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" | 28 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" |
| 32 #include "chrome/browser/ui/browser.h" | 29 #include "chrome/browser/ui/browser.h" |
| 33 #include "chrome/browser/ui/browser_finder.h" | 30 #include "chrome/browser/ui/browser_finder.h" |
| 34 #include "chrome/browser/ui/browser_instant_controller.h" | |
| 35 #include "chrome/browser/ui/browser_window.h" | 31 #include "chrome/browser/ui/browser_window.h" |
| 36 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 32 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
| 37 #include "chrome/browser/ui/layout_constants.h" | 33 #include "chrome/browser/ui/layout_constants.h" |
| 38 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 34 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
| 39 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 35 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 40 #include "chrome/browser/ui/views/autofill/save_card_icon_view.h" | 36 #include "chrome/browser/ui/views/autofill/save_card_icon_view.h" |
| 41 #include "chrome/browser/ui/views/browser_dialogs.h" | 37 #include "chrome/browser/ui/views/browser_dialogs.h" |
| 42 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h" | 38 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h" |
| 43 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" | 39 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" |
| 44 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" | 40 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" |
| (...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 } | 1236 } |
| 1241 | 1237 |
| 1242 //////////////////////////////////////////////////////////////////////////////// | 1238 //////////////////////////////////////////////////////////////////////////////// |
| 1243 // LocationBarView, private views::View implementation: | 1239 // LocationBarView, private views::View implementation: |
| 1244 | 1240 |
| 1245 const char* LocationBarView::GetClassName() const { | 1241 const char* LocationBarView::GetClassName() const { |
| 1246 return kViewClassName; | 1242 return kViewClassName; |
| 1247 } | 1243 } |
| 1248 | 1244 |
| 1249 void LocationBarView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 1245 void LocationBarView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
| 1250 InstantService* instant_service = | |
| 1251 InstantServiceFactory::GetForProfile(profile()); | |
| 1252 if (instant_service) | |
| 1253 instant_service->OnOmniboxStartMarginChanged(bounds().x()); | |
| 1254 | |
| 1255 OmniboxPopupView* popup = omnibox_view_->model()->popup_model()->view(); | 1246 OmniboxPopupView* popup = omnibox_view_->model()->popup_model()->view(); |
| 1256 if (popup->IsOpen()) | 1247 if (popup->IsOpen()) |
| 1257 popup->UpdatePopupAppearance(); | 1248 popup->UpdatePopupAppearance(); |
| 1258 } | 1249 } |
| 1259 | 1250 |
| 1260 void LocationBarView::OnFocus() { | 1251 void LocationBarView::OnFocus() { |
| 1261 // Explicitly focus the omnibox so a focus ring will be displayed around it on | 1252 // Explicitly focus the omnibox so a focus ring will be displayed around it on |
| 1262 // Windows. | 1253 // Windows. |
| 1263 omnibox_view_->SetFocus(); | 1254 omnibox_view_->SetFocus(); |
| 1264 } | 1255 } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1381 // LocationBarView, private TemplateURLServiceObserver implementation: | 1372 // LocationBarView, private TemplateURLServiceObserver implementation: |
| 1382 | 1373 |
| 1383 void LocationBarView::OnTemplateURLServiceChanged() { | 1374 void LocationBarView::OnTemplateURLServiceChanged() { |
| 1384 template_url_service_->RemoveObserver(this); | 1375 template_url_service_->RemoveObserver(this); |
| 1385 template_url_service_ = nullptr; | 1376 template_url_service_ = nullptr; |
| 1386 // If the browser is no longer active, let's not show the info bubble, as this | 1377 // If the browser is no longer active, let's not show the info bubble, as this |
| 1387 // would make the browser the active window again. | 1378 // would make the browser the active window again. |
| 1388 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1379 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
| 1389 ShowFirstRunBubble(); | 1380 ShowFirstRunBubble(); |
| 1390 } | 1381 } |
| OLD | NEW |