| 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/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" |
| (...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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 void LocationBarViewMac::UpdateChromeToMobileEnabled() { | 743 void LocationBarViewMac::UpdateChromeToMobileEnabled() { |
| 745 if (!chrome_to_mobile_decoration_.get()) | 744 if (!chrome_to_mobile_decoration_.get()) |
| 746 return; | 745 return; |
| 747 | 746 |
| 748 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled()); | 747 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled()); |
| 749 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() && | 748 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() && |
| 750 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasMobiles(); | 749 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasMobiles(); |
| 751 chrome_to_mobile_decoration_->SetVisible(enabled); | 750 chrome_to_mobile_decoration_->SetVisible(enabled); |
| 752 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); | 751 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); |
| 753 } | 752 } |
| OLD | NEW |