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.h" | 9 #include "base/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
15 #include "chrome/browser/alternate_nav_url_fetcher.h" | 15 #include "chrome/browser/alternate_nav_url_fetcher.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/tabs/tabs.h" | 19 #include "chrome/browser/extensions/api/tabs/tabs.h" |
20 #include "chrome/browser/extensions/extension_action.h" | 20 #include "chrome/browser/extensions/extension_action.h" |
21 #include "chrome/browser/extensions/extension_service.h" | 21 #include "chrome/browser/extensions/extension_service.h" |
| 22 #include "chrome/browser/extensions/extension_system.h" |
22 #include "chrome/browser/extensions/location_bar_controller.h" | 23 #include "chrome/browser/extensions/location_bar_controller.h" |
23 #include "chrome/browser/extensions/tab_helper.h" | 24 #include "chrome/browser/extensions/tab_helper.h" |
24 #include "chrome/browser/prefs/pref_service.h" | 25 #include "chrome/browser/prefs/pref_service.h" |
25 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
26 #include "chrome/browser/search_engines/template_url.h" | 27 #include "chrome/browser/search_engines/template_url.h" |
27 #include "chrome/browser/search_engines/template_url_service.h" | 28 #include "chrome/browser/search_engines/template_url_service.h" |
28 #include "chrome/browser/search_engines/template_url_service_factory.h" | 29 #include "chrome/browser/search_engines/template_url_service_factory.h" |
29 #include "chrome/browser/ui/browser_instant_controller.h" | 30 #include "chrome/browser/ui/browser_instant_controller.h" |
30 #include "chrome/browser/ui/browser_list.h" | 31 #include "chrome/browser/ui/browser_list.h" |
31 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
" | 32 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
" |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 const NSPoint point = | 555 const NSPoint point = |
555 location_icon_decoration_->GetBubblePointInFrame(frame); | 556 location_icon_decoration_->GetBubblePointInFrame(frame); |
556 return [field_ convertPoint:point toView:nil]; | 557 return [field_ convertPoint:point toView:nil]; |
557 } | 558 } |
558 } | 559 } |
559 | 560 |
560 NSImage* LocationBarViewMac::GetKeywordImage(const string16& keyword) { | 561 NSImage* LocationBarViewMac::GetKeywordImage(const string16& keyword) { |
561 const TemplateURL* template_url = TemplateURLServiceFactory::GetForProfile( | 562 const TemplateURL* template_url = TemplateURLServiceFactory::GetForProfile( |
562 profile_)->GetTemplateURLForKeyword(keyword); | 563 profile_)->GetTemplateURLForKeyword(keyword); |
563 if (template_url && template_url->IsExtensionKeyword()) { | 564 if (template_url && template_url->IsExtensionKeyword()) { |
564 return profile_->GetExtensionService()->GetOmniboxIcon( | 565 return extensions::ExtensionSystem::Get(profile_)->extension_service()-> |
565 template_url->GetExtensionId()).AsNSImage(); | 566 GetOmniboxIcon(template_url->GetExtensionId()).AsNSImage(); |
566 } | 567 } |
567 | 568 |
568 return OmniboxViewMac::ImageForResource(IDR_OMNIBOX_SEARCH); | 569 return OmniboxViewMac::ImageForResource(IDR_OMNIBOX_SEARCH); |
569 } | 570 } |
570 | 571 |
571 void LocationBarViewMac::Observe(int type, | 572 void LocationBarViewMac::Observe(int type, |
572 const content::NotificationSource& source, | 573 const content::NotificationSource& source, |
573 const content::NotificationDetails& details) { | 574 const content::NotificationDetails& details) { |
574 switch (type) { | 575 switch (type) { |
575 case chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: { | 576 case chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 visible = false; | 777 visible = false; |
777 star_decoration_->SetVisible(visible); | 778 star_decoration_->SetVisible(visible); |
778 } | 779 } |
779 | 780 |
780 void LocationBarViewMac::UpdatePlusDecorationVisibility() { | 781 void LocationBarViewMac::UpdatePlusDecorationVisibility() { |
781 if (extensions::FeatureSwitch::action_box()->IsEnabled()) { | 782 if (extensions::FeatureSwitch::action_box()->IsEnabled()) { |
782 // If the action box is enabled, hide it when input is in progress. | 783 // If the action box is enabled, hide it when input is in progress. |
783 plus_decoration_->SetVisible(!toolbar_model_->GetInputInProgress()); | 784 plus_decoration_->SetVisible(!toolbar_model_->GetInputInProgress()); |
784 } | 785 } |
785 } | 786 } |
OLD | NEW |