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 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
| 16 #import "chrome/browser/app_controller_mac.h" | 16 #import "chrome/browser/app_controller_mac.h" |
| 17 #include "chrome/browser/command_updater.h" | 17 #include "chrome/browser/command_updater.h" |
| 18 #include "chrome/browser/defaults.h" | 18 #include "chrome/browser/defaults.h" |
| 19 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" | 19 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" |
| 20 #include "chrome/browser/extensions/api/tabs/tabs_api.h" | 20 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
| 21 #include "chrome/browser/extensions/extension_action.h" | 21 #include "chrome/browser/extensions/extension_action.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" | 25 #include "chrome/browser/search/instant_service.h" |
|
samarth
2015/12/28 20:12:22
I think you can remove these includes now.
Peter Kasting
2016/01/04 21:47:11
Done.
| |
| 26 #include "chrome/browser/search/instant_service_factory.h" | 26 #include "chrome/browser/search/instant_service_factory.h" |
| 27 #include "chrome/browser/search/search.h" | 27 #include "chrome/browser/search/search.h" |
| 28 #include "chrome/browser/search_engines/template_url_service_factory.h" | 28 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 29 #include "chrome/browser/translate/chrome_translate_client.h" | 29 #include "chrome/browser/translate/chrome_translate_client.h" |
| 30 #include "chrome/browser/translate/translate_service.h" | 30 #include "chrome/browser/translate/translate_service.h" |
| 31 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" | 31 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" |
| 32 #include "chrome/browser/ui/browser_list.h" | 32 #include "chrome/browser/ui/browser_list.h" |
| 33 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 33 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 34 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h " | 34 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h " |
| 35 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" | 35 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 551 Update(nullptr); | 551 Update(nullptr); |
| 552 } | 552 } |
| 553 | 553 |
| 554 void LocationBarViewMac::OnChanged() { | 554 void LocationBarViewMac::OnChanged() { |
| 555 // Update the location-bar icon. | 555 // Update the location-bar icon. |
| 556 const int resource_id = omnibox_view_->GetIcon(); | 556 const int resource_id = omnibox_view_->GetIcon(); |
| 557 NSImage* image = OmniboxViewMac::ImageForResource(resource_id); | 557 NSImage* image = OmniboxViewMac::ImageForResource(resource_id); |
| 558 location_icon_decoration_->SetImage(image); | 558 location_icon_decoration_->SetImage(image); |
| 559 ev_bubble_decoration_->SetImage(image); | 559 ev_bubble_decoration_->SetImage(image); |
| 560 Layout(); | 560 Layout(); |
| 561 | |
| 562 InstantService* instant_service = | |
| 563 InstantServiceFactory::GetForProfile(profile()); | |
| 564 if (instant_service) { | |
| 565 gfx::Rect bounds(NSRectToCGRect([field_ frame])); | |
| 566 instant_service->OnOmniboxStartMarginChanged(bounds.x()); | |
| 567 } | |
| 568 } | 561 } |
| 569 | 562 |
| 570 void LocationBarViewMac::OnSetFocus() { | 563 void LocationBarViewMac::OnSetFocus() { |
| 571 // Update the keyword and search hint states. | 564 // Update the keyword and search hint states. |
| 572 OnChanged(); | 565 OnChanged(); |
| 573 } | 566 } |
| 574 | 567 |
| 575 void LocationBarViewMac::ShowURL() { | 568 void LocationBarViewMac::ShowURL() { |
| 576 omnibox_view_->ShowURL(); | 569 omnibox_view_->ShowURL(); |
| 577 } | 570 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 730 | 723 |
| 731 return zoom_decoration_->UpdateIfNecessary( | 724 return zoom_decoration_->UpdateIfNecessary( |
| 732 ui_zoom::ZoomController::FromWebContents(web_contents), | 725 ui_zoom::ZoomController::FromWebContents(web_contents), |
| 733 default_zoom_changed); | 726 default_zoom_changed); |
| 734 } | 727 } |
| 735 | 728 |
| 736 void LocationBarViewMac::OnDefaultZoomLevelChanged() { | 729 void LocationBarViewMac::OnDefaultZoomLevelChanged() { |
| 737 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) | 730 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) |
| 738 OnDecorationsChanged(); | 731 OnDecorationsChanged(); |
| 739 } | 732 } |
| OLD | NEW |