| 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 #include "chrome/browser/printing/print_dialog_cloud.h" | 5 #include "chrome/browser/printing/print_dialog_cloud.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 void CreateCloudPrintSigninTab(Browser* browser, | 63 void CreateCloudPrintSigninTab(Browser* browser, |
| 64 bool add_account, | 64 bool add_account, |
| 65 const base::Closure& callback) { | 65 const base::Closure& callback) { |
| 66 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 66 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 67 if (switches::IsEnableAccountConsistency() && | 67 if (switches::IsEnableAccountConsistency() && |
| 68 !browser->profile()->IsOffTheRecord()) { | 68 !browser->profile()->IsOffTheRecord()) { |
| 69 browser->window()->ShowAvatarBubbleFromAvatarButton( | 69 browser->window()->ShowAvatarBubbleFromAvatarButton( |
| 70 add_account ? BrowserWindow::AVATAR_BUBBLE_MODE_ADD_ACCOUNT | 70 add_account ? BrowserWindow::AVATAR_BUBBLE_MODE_ADD_ACCOUNT |
| 71 : BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, | 71 : BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, |
| 72 signin::ManageAccountsParams()); | 72 signin::ManageAccountsParams(), |
| 73 signin_metrics::ACCESS_POINT_CLOUD_PRINT); |
| 73 } else { | 74 } else { |
| 74 GURL url = add_account ? cloud_devices::GetCloudPrintAddAccountURL() | 75 GURL url = add_account ? cloud_devices::GetCloudPrintAddAccountURL() |
| 75 : cloud_devices::GetCloudPrintSigninURL(); | 76 : cloud_devices::GetCloudPrintSigninURL(); |
| 76 content::WebContents* web_contents = | 77 content::WebContents* web_contents = |
| 77 browser->OpenURL(content::OpenURLParams( | 78 browser->OpenURL(content::OpenURLParams( |
| 78 google_util::AppendGoogleLocaleParam( | 79 google_util::AppendGoogleLocaleParam( |
| 79 url, g_browser_process->GetApplicationLocale()), | 80 url, g_browser_process->GetApplicationLocale()), |
| 80 content::Referrer(), | 81 content::Referrer(), |
| 81 NEW_FOREGROUND_TAB, | 82 NEW_FOREGROUND_TAB, |
| 82 ui::PAGE_TRANSITION_AUTO_BOOKMARK, | 83 ui::PAGE_TRANSITION_AUTO_BOOKMARK, |
| 83 false)); | 84 false)); |
| 84 new SignInObserver(web_contents, callback); | 85 new SignInObserver(web_contents, callback); |
| 85 } | 86 } |
| 86 } | 87 } |
| 87 | 88 |
| 88 } // namespace print_dialog_cloud | 89 } // namespace print_dialog_cloud |
| OLD | NEW |