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

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_helper.h

Issue 10911169: Setup field trial for one-click signin inforbar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 3 months 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 | Annotate | Revision Log
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 #ifndef CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ 5 #ifndef CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_
6 #define CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ 6 #define CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "content/public/browser/web_contents_observer.h" 10 #include "content/public/browser/web_contents_observer.h"
11 11
12 namespace content { 12 namespace content {
13 class WebContents; 13 class WebContents;
14 } 14 }
15 15
16 namespace net { 16 namespace net {
17 class URLRequest; 17 class URLRequest;
18 } 18 }
19 19
20 // Per-tab one-click signin helper. When a user signs in to a Google service 20 // Per-tab one-click signin helper. When a user signs in to a Google service
21 // and the profile is not yet connected to a Google account, will start the 21 // and the profile is not yet connected to a Google account, will start the
22 // process of helping the user connect his profile with one click. The process 22 // process of helping the user connect his profile with one click. The process
23 // begins with an infobar and is followed with a confirmation dialog explaining 23 // begins with an infobar and is followed with a confirmation dialog explaining
24 // more about what this means. 24 // more about what this means.
25 class OneClickSigninHelper : public content::WebContentsObserver { 25 class OneClickSigninHelper : public content::WebContentsObserver {
26 public: 26 public:
27 explicit OneClickSigninHelper(content::WebContents* web_contents);
28 virtual ~OneClickSigninHelper();
29
27 // Returns true if the one-click signin feature can be offered at this time. 30 // Returns true if the one-click signin feature can be offered at this time.
28 // It can be offered if the contents is not in an incognito window. If 31 // It can be offered if the contents is not in an incognito window. If
29 // |check_connected| is true, then the profile is checked to see if it's 32 // |check_connected| is true, then the profile is checked to see if it's
30 // already connected to a google account or if the user has already rejected 33 // already connected to a google account or if the user has already rejected
31 // one-click sign-in with this email, in which cases a one click signin 34 // one-click sign-in with this email, in which cases a one click signin
32 // should not be offered. 35 // should not be offered.
33 static bool CanOffer(content::WebContents* web_contents, 36 static bool CanOffer(content::WebContents* web_contents,
34 const std::string& email, 37 const std::string& email,
35 bool check_connected); 38 bool check_connected);
36 39
40 // Initialize a finch experiment for the infobar.
41 static void InitializeFieldTrial();
42
37 // Looks for the Google-Accounts-SignIn response header, and if found, 43 // Looks for the Google-Accounts-SignIn response header, and if found,
38 // tries to display an infobar in the tab contents identified by the 44 // tries to display an infobar in the tab contents identified by the
39 // child/route id. 45 // child/route id.
40 static void ShowInfoBarIfPossible(net::URLRequest* request, 46 static void ShowInfoBarIfPossible(net::URLRequest* request,
41 int child_id, 47 int child_id,
42 int route_id); 48 int route_id);
43 49
44 explicit OneClickSigninHelper(content::WebContents* web_contents);
45 virtual ~OneClickSigninHelper();
46
47 private: 50 private:
48 // The portion of ShowInfoBarIfPossible() that needs to run on the UI thread. 51 // The portion of ShowInfoBarIfPossible() that needs to run on the UI thread.
49 static void ShowInfoBarUIThread(const std::string& session_index, 52 static void ShowInfoBarUIThread(const std::string& session_index,
50 const std::string& email, 53 const std::string& email,
51 int child_id, 54 int child_id,
52 int route_id); 55 int route_id);
53 56
54 // content::WebContentsObserver overrides. 57 // content::WebContentsObserver overrides.
55 virtual void DidNavigateAnyFrame( 58 virtual void DidNavigateAnyFrame(
56 const content::LoadCommittedDetails& details, 59 const content::LoadCommittedDetails& details,
(...skipping 10 matching lines...) Expand all
67 70
68 // Information about the account that has just logged in. 71 // Information about the account that has just logged in.
69 std::string session_index_; 72 std::string session_index_;
70 std::string email_; 73 std::string email_;
71 std::string password_; 74 std::string password_;
72 75
73 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); 76 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper);
74 }; 77 };
75 78
76 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ 79 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_field_trials.cc ('k') | chrome/browser/ui/sync/one_click_signin_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698