| 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" | |
| 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_list.h" | 29 #include "chrome/browser/ui/browser_list.h" |
| 33 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 30 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 34 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
" | 31 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
" |
| 35 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" | 32 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" |
| 36 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h" | 33 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h" |
| 37 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" | 34 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 Update(nullptr); | 548 Update(nullptr); |
| 552 } | 549 } |
| 553 | 550 |
| 554 void LocationBarViewMac::OnChanged() { | 551 void LocationBarViewMac::OnChanged() { |
| 555 // Update the location-bar icon. | 552 // Update the location-bar icon. |
| 556 const int resource_id = omnibox_view_->GetIcon(); | 553 const int resource_id = omnibox_view_->GetIcon(); |
| 557 NSImage* image = OmniboxViewMac::ImageForResource(resource_id); | 554 NSImage* image = OmniboxViewMac::ImageForResource(resource_id); |
| 558 location_icon_decoration_->SetImage(image); | 555 location_icon_decoration_->SetImage(image); |
| 559 ev_bubble_decoration_->SetImage(image); | 556 ev_bubble_decoration_->SetImage(image); |
| 560 Layout(); | 557 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 } | 558 } |
| 569 | 559 |
| 570 void LocationBarViewMac::OnSetFocus() { | 560 void LocationBarViewMac::OnSetFocus() { |
| 571 // Update the keyword and search hint states. | 561 // Update the keyword and search hint states. |
| 572 OnChanged(); | 562 OnChanged(); |
| 573 } | 563 } |
| 574 | 564 |
| 575 void LocationBarViewMac::ShowURL() { | 565 void LocationBarViewMac::ShowURL() { |
| 576 omnibox_view_->ShowURL(); | 566 omnibox_view_->ShowURL(); |
| 577 } | 567 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 | 720 |
| 731 return zoom_decoration_->UpdateIfNecessary( | 721 return zoom_decoration_->UpdateIfNecessary( |
| 732 ui_zoom::ZoomController::FromWebContents(web_contents), | 722 ui_zoom::ZoomController::FromWebContents(web_contents), |
| 733 default_zoom_changed); | 723 default_zoom_changed); |
| 734 } | 724 } |
| 735 | 725 |
| 736 void LocationBarViewMac::OnDefaultZoomLevelChanged() { | 726 void LocationBarViewMac::OnDefaultZoomLevelChanged() { |
| 737 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) | 727 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) |
| 738 OnDecorationsChanged(); | 728 OnDecorationsChanged(); |
| 739 } | 729 } |
| OLD | NEW |