| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/chromeos/login/signin/merge_session_load_page.h" | 5 #include "chrome/browser/chromeos/login/signin/merge_session_load_page.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
| 9 #include "ash/system/tray/system_tray_delegate.h" | 9 #include "ash/system/tray/system_tray_delegate.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 const GURL& url, | 57 const GURL& url, |
| 58 const MergeSessionThrottle::CompletionCallback& callback) | 58 const MergeSessionThrottle::CompletionCallback& callback) |
| 59 : callback_(callback), | 59 : callback_(callback), |
| 60 proceeded_(false), | 60 proceeded_(false), |
| 61 web_contents_(web_contents), | 61 web_contents_(web_contents), |
| 62 url_(url) { | 62 url_(url) { |
| 63 interstitial_page_ = InterstitialPage::Create(web_contents, true, url, this); | 63 interstitial_page_ = InterstitialPage::Create(web_contents, true, url, this); |
| 64 } | 64 } |
| 65 | 65 |
| 66 MergeSessionLoadPage::~MergeSessionLoadPage() { | 66 MergeSessionLoadPage::~MergeSessionLoadPage() { |
| 67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 67 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void MergeSessionLoadPage::Show() { | 70 void MergeSessionLoadPage::Show() { |
| 71 OAuth2LoginManager* manager = GetOAuth2LoginManager(); | 71 OAuth2LoginManager* manager = GetOAuth2LoginManager(); |
| 72 if (manager && manager->ShouldBlockTabLoading()) { | 72 if (manager && manager->ShouldBlockTabLoading()) { |
| 73 manager->AddObserver(this); | 73 manager->AddObserver(this); |
| 74 interstitial_page_->Show(); | 74 interstitial_page_->Show(); |
| 75 } else { | 75 } else { |
| 76 interstitial_page_->Proceed(); | 76 interstitial_page_->Proceed(); |
| 77 } | 77 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 99 | 99 |
| 100 void MergeSessionLoadPage::OverrideRendererPrefs( | 100 void MergeSessionLoadPage::OverrideRendererPrefs( |
| 101 content::RendererPreferences* prefs) { | 101 content::RendererPreferences* prefs) { |
| 102 Profile* profile = Profile::FromBrowserContext( | 102 Profile* profile = Profile::FromBrowserContext( |
| 103 web_contents_->GetBrowserContext()); | 103 web_contents_->GetBrowserContext()); |
| 104 renderer_preferences_util::UpdateFromSystemSettings( | 104 renderer_preferences_util::UpdateFromSystemSettings( |
| 105 prefs, profile, web_contents_); | 105 prefs, profile, web_contents_); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void MergeSessionLoadPage::OnProceed() { | 108 void MergeSessionLoadPage::OnProceed() { |
| 109 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 109 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 110 proceeded_ = true; | 110 proceeded_ = true; |
| 111 NotifyBlockingPageComplete(); | 111 NotifyBlockingPageComplete(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void MergeSessionLoadPage::OnDontProceed() { | 114 void MergeSessionLoadPage::OnDontProceed() { |
| 115 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 115 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 116 // Ignore if it's already proceeded. | 116 // Ignore if it's already proceeded. |
| 117 if (proceeded_) | 117 if (proceeded_) |
| 118 return; | 118 return; |
| 119 NotifyBlockingPageComplete(); | 119 NotifyBlockingPageComplete(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void MergeSessionLoadPage::CommandReceived(const std::string& cmd) { | 122 void MergeSessionLoadPage::CommandReceived(const std::string& cmd) { |
| 123 std::string command(cmd); | 123 std::string command(cmd); |
| 124 // The Jasonified response has quotes, remove them. | 124 // The Jasonified response has quotes, remove them. |
| 125 if (command.length() > 1 && command[0] == '"') | 125 if (command.length() > 1 && command[0] == '"') |
| (...skipping 24 matching lines...) Expand all Loading... |
| 150 | 150 |
| 151 Profile* profile = Profile::FromBrowserContext(browser_context); | 151 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 152 if (!profile) | 152 if (!profile) |
| 153 return NULL; | 153 return NULL; |
| 154 | 154 |
| 155 return OAuth2LoginManagerFactory::GetInstance()->GetForProfile(profile); | 155 return OAuth2LoginManagerFactory::GetInstance()->GetForProfile(profile); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void MergeSessionLoadPage::OnSessionRestoreStateChanged( | 158 void MergeSessionLoadPage::OnSessionRestoreStateChanged( |
| 159 Profile* user_profile, OAuth2LoginManager::SessionRestoreState state) { | 159 Profile* user_profile, OAuth2LoginManager::SessionRestoreState state) { |
| 160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 160 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 161 | 161 |
| 162 OAuth2LoginManager* manager = GetOAuth2LoginManager(); | 162 OAuth2LoginManager* manager = GetOAuth2LoginManager(); |
| 163 DVLOG(1) << "Merge session should " | 163 DVLOG(1) << "Merge session should " |
| 164 << (!manager->ShouldBlockTabLoading() ? | 164 << (!manager->ShouldBlockTabLoading() ? |
| 165 " NOT " : "") | 165 " NOT " : "") |
| 166 << " be blocking now, " | 166 << " be blocking now, " |
| 167 << state; | 167 << state; |
| 168 if (!manager->ShouldBlockTabLoading()) { | 168 if (!manager->ShouldBlockTabLoading()) { |
| 169 manager->RemoveObserver(this); | 169 manager->RemoveObserver(this); |
| 170 interstitial_page_->Proceed(); | 170 interstitial_page_->Proceed(); |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace chromeos | 174 } // namespace chromeos |
| OLD | NEW |