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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 content::PAGE_TRANSITION_TYPED | | 110 content::PAGE_TRANSITION_TYPED | |
111 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)), | 111 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)), |
112 weak_ptr_factory_(this) { | 112 weak_ptr_factory_(this) { |
113 // Disable Chrome To Mobile for off-the-record and non-synced profiles, | 113 // Disable Chrome To Mobile for off-the-record and non-synced profiles, |
114 // or if the feature is disabled by a command line flag or chrome://flags. | 114 // or if the feature is disabled by a command line flag or chrome://flags. |
115 if (!profile_->IsOffTheRecord() && profile_->IsSyncAccessible() && | 115 if (!profile_->IsOffTheRecord() && profile_->IsSyncAccessible() && |
116 ChromeToMobileService::IsChromeToMobileEnabled()) { | 116 ChromeToMobileService::IsChromeToMobileEnabled()) { |
117 command_updater_->AddCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this); | 117 command_updater_->AddCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this); |
118 chrome_to_mobile_decoration_.reset( | 118 chrome_to_mobile_decoration_.reset( |
119 new ChromeToMobileDecoration(profile, command_updater)); | 119 new ChromeToMobileDecoration(profile, command_updater)); |
120 ChromeToMobileServiceFactory::GetForProfile(profile)-> | 120 UpdateChromeToMobileEnabled(); |
121 RequestMobileListUpdate(); | |
122 } | 121 } |
123 | 122 |
124 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableActionBox)) { | 123 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableActionBox)) { |
125 plus_decoration_.reset(new PlusDecoration(this, command_updater, browser_)); | 124 plus_decoration_.reset(new PlusDecoration(this, command_updater, browser_)); |
126 } | 125 } |
127 | 126 |
128 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 127 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
129 DCHECK_EQ(i, content_setting_decorations_.size()); | 128 DCHECK_EQ(i, content_setting_decorations_.size()); |
130 ContentSettingsType type = static_cast<ContentSettingsType>(i); | 129 ContentSettingsType type = static_cast<ContentSettingsType>(i); |
131 content_setting_decorations_.push_back( | 130 content_setting_decorations_.push_back( |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 void LocationBarViewMac::UpdateChromeToMobileEnabled() { | 731 void LocationBarViewMac::UpdateChromeToMobileEnabled() { |
733 if (!chrome_to_mobile_decoration_.get()) | 732 if (!chrome_to_mobile_decoration_.get()) |
734 return; | 733 return; |
735 | 734 |
736 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled()); | 735 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled()); |
737 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() && | 736 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() && |
738 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasMobiles(); | 737 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasMobiles(); |
739 chrome_to_mobile_decoration_->SetVisible(enabled); | 738 chrome_to_mobile_decoration_->SetVisible(enabled); |
740 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); | 739 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); |
741 } | 740 } |
OLD | NEW |