Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: chrome/browser/printing/print_dialog_cloud.cc

Issue 1473543002: Implement newly designed sign-in related histograms for desktop platorms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/browser_window.h" 12 #include "chrome/browser/ui/browser_window.h"
13 #include "components/cloud_devices/common/cloud_devices_urls.h" 13 #include "components/cloud_devices/common/cloud_devices_urls.h"
14 #include "components/google/core/browser/google_util.h" 14 #include "components/google/core/browser/google_util.h"
15 #include "components/signin/core/browser/signin_header_helper.h" 15 #include "components/signin/core/browser/signin_header_helper.h"
16 #include "components/signin/core/browser/signin_metrics.h"
16 #include "components/signin/core/common/profile_management_switches.h" 17 #include "components/signin/core/common/profile_management_switches.h"
17 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
19 #include "content/public/browser/web_contents_observer.h" 20 #include "content/public/browser/web_contents_observer.h"
20 21
21 namespace print_dialog_cloud { 22 namespace print_dialog_cloud {
22 23
23 namespace { 24 namespace {
24 25
25 class SignInObserver : public content::WebContentsObserver { 26 class SignInObserver : public content::WebContentsObserver {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 63
63 void CreateCloudPrintSigninTab(Browser* browser, 64 void CreateCloudPrintSigninTab(Browser* browser,
64 bool add_account, 65 bool add_account,
65 const base::Closure& callback) { 66 const base::Closure& callback) {
66 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 67 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
67 if (switches::IsEnableAccountConsistency() && 68 if (switches::IsEnableAccountConsistency() &&
68 !browser->profile()->IsOffTheRecord()) { 69 !browser->profile()->IsOffTheRecord()) {
69 browser->window()->ShowAvatarBubbleFromAvatarButton( 70 browser->window()->ShowAvatarBubbleFromAvatarButton(
70 add_account ? BrowserWindow::AVATAR_BUBBLE_MODE_ADD_ACCOUNT 71 add_account ? BrowserWindow::AVATAR_BUBBLE_MODE_ADD_ACCOUNT
71 : BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, 72 : BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN,
72 signin::ManageAccountsParams()); 73 signin::ManageAccountsParams(),
74 signin_metrics::AccessPoint::ACCESS_POINT_CLOUD_PRINT);
73 } else { 75 } else {
74 GURL url = add_account ? cloud_devices::GetCloudPrintAddAccountURL() 76 GURL url = add_account ? cloud_devices::GetCloudPrintAddAccountURL()
75 : cloud_devices::GetCloudPrintSigninURL(); 77 : cloud_devices::GetCloudPrintSigninURL();
76 content::WebContents* web_contents = 78 content::WebContents* web_contents =
77 browser->OpenURL(content::OpenURLParams( 79 browser->OpenURL(content::OpenURLParams(
78 google_util::AppendGoogleLocaleParam( 80 google_util::AppendGoogleLocaleParam(
79 url, g_browser_process->GetApplicationLocale()), 81 url, g_browser_process->GetApplicationLocale()),
80 content::Referrer(), 82 content::Referrer(),
81 NEW_FOREGROUND_TAB, 83 NEW_FOREGROUND_TAB,
82 ui::PAGE_TRANSITION_AUTO_BOOKMARK, 84 ui::PAGE_TRANSITION_AUTO_BOOKMARK,
83 false)); 85 false));
84 new SignInObserver(web_contents, callback); 86 new SignInObserver(web_contents, callback);
85 } 87 }
86 } 88 }
87 89
88 } // namespace print_dialog_cloud 90 } // namespace print_dialog_cloud
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698