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