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 #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/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #import "chrome/browser/ui/cocoa/location_bar/plus_decoration.h" | 44 #import "chrome/browser/ui/cocoa/location_bar/plus_decoration.h" |
45 #import "chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h" | 45 #import "chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h" |
46 #import "chrome/browser/ui/cocoa/location_bar/star_decoration.h" | 46 #import "chrome/browser/ui/cocoa/location_bar/star_decoration.h" |
47 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" | 47 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
48 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 48 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
49 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" | 49 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" |
50 #include "chrome/browser/ui/omnibox/location_bar_util.h" | 50 #include "chrome/browser/ui/omnibox/location_bar_util.h" |
51 #import "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 51 #import "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
52 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 52 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
53 #include "chrome/common/chrome_notification_types.h" | 53 #include "chrome/common/chrome_notification_types.h" |
| 54 #include "chrome/common/chrome_switches.h" |
54 #include "chrome/common/extensions/extension.h" | 55 #include "chrome/common/extensions/extension.h" |
55 #include "chrome/common/extensions/extension_action.h" | 56 #include "chrome/common/extensions/extension_action.h" |
56 #include "chrome/common/extensions/extension_resource.h" | 57 #include "chrome/common/extensions/extension_resource.h" |
57 #include "chrome/common/extensions/extension_switch_utils.h" | 58 #include "chrome/common/extensions/extension_switch_utils.h" |
58 #include "chrome/common/pref_names.h" | 59 #include "chrome/common/pref_names.h" |
59 #include "content/public/browser/notification_service.h" | 60 #include "content/public/browser/notification_service.h" |
60 #include "content/public/browser/web_contents.h" | 61 #include "content/public/browser/web_contents.h" |
61 #include "grit/generated_resources.h" | 62 #include "grit/generated_resources.h" |
62 #include "grit/theme_resources.h" | 63 #include "grit/theme_resources.h" |
63 #include "net/base/net_util.h" | 64 #include "net/base/net_util.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // or if the feature is disabled by a command line flag or chrome://flags. | 113 // or if the feature is disabled by a command line flag or chrome://flags. |
113 if (!profile_->IsOffTheRecord() && profile_->IsSyncAccessible() && | 114 if (!profile_->IsOffTheRecord() && profile_->IsSyncAccessible() && |
114 ChromeToMobileService::IsChromeToMobileEnabled()) { | 115 ChromeToMobileService::IsChromeToMobileEnabled()) { |
115 command_updater_->AddCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this); | 116 command_updater_->AddCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this); |
116 chrome_to_mobile_decoration_.reset( | 117 chrome_to_mobile_decoration_.reset( |
117 new ChromeToMobileDecoration(profile, command_updater)); | 118 new ChromeToMobileDecoration(profile, command_updater)); |
118 ChromeToMobileServiceFactory::GetForProfile(profile)-> | 119 ChromeToMobileServiceFactory::GetForProfile(profile)-> |
119 RequestMobileListUpdate(); | 120 RequestMobileListUpdate(); |
120 } | 121 } |
121 | 122 |
122 if (extensions::switch_utils::IsActionBoxEnabled()) { | 123 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableActionBox)) { |
123 plus_decoration_.reset(new PlusDecoration(this, command_updater, browser_)); | 124 plus_decoration_.reset(new PlusDecoration(this, command_updater, browser_)); |
124 } | 125 } |
125 | 126 |
126 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 127 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
127 DCHECK_EQ(i, content_setting_decorations_.size()); | 128 DCHECK_EQ(i, content_setting_decorations_.size()); |
128 ContentSettingsType type = static_cast<ContentSettingsType>(i); | 129 ContentSettingsType type = static_cast<ContentSettingsType>(i); |
129 content_setting_decorations_.push_back( | 130 content_setting_decorations_.push_back( |
130 new ContentSettingDecoration(type, this, profile_)); | 131 new ContentSettingDecoration(type, this, profile_)); |
131 } | 132 } |
132 | 133 |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 void LocationBarViewMac::UpdateChromeToMobileEnabled() { | 727 void LocationBarViewMac::UpdateChromeToMobileEnabled() { |
727 if (!chrome_to_mobile_decoration_.get()) | 728 if (!chrome_to_mobile_decoration_.get()) |
728 return; | 729 return; |
729 | 730 |
730 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled()); | 731 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled()); |
731 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() && | 732 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() && |
732 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasMobiles(); | 733 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasMobiles(); |
733 chrome_to_mobile_decoration_->SetVisible(enabled); | 734 chrome_to_mobile_decoration_->SetVisible(enabled); |
734 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); | 735 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); |
735 } | 736 } |
OLD | NEW |