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 #ifndef CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_OBSERVER_H_ |
6 #define CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_OBSERVER_H_ | 6 #define CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_OBSERVER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "components/sync/driver/sync_service_observer.h" | 10 #include "components/sync/driver/sync_service_observer.h" |
11 #include "content/public/browser/web_contents_observer.h" | 11 #include "content/public/browser/web_contents_observer.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
| 14 namespace browser_sync { |
14 class ProfileSyncService; | 15 class ProfileSyncService; |
| 16 } |
15 | 17 |
16 namespace content { | 18 namespace content { |
17 class WebContents; | 19 class WebContents; |
18 } | 20 } |
19 | 21 |
20 class OneClickSigninSyncObserver : public content::WebContentsObserver, | 22 class OneClickSigninSyncObserver : public content::WebContentsObserver, |
21 public sync_driver::SyncServiceObserver { | 23 public sync_driver::SyncServiceObserver { |
22 public: | 24 public: |
23 // Waits for Sync to be initialized, then navigates the |web_contents| to the | 25 // Waits for Sync to be initialized, then navigates the |web_contents| to the |
24 // |continue_url|. Instances of this class delete themselves once the job is | 26 // |continue_url|. Instances of this class delete themselves once the job is |
(...skipping 10 matching lines...) Expand all Loading... |
35 void WebContentsDestroyed() override; | 37 void WebContentsDestroyed() override; |
36 | 38 |
37 // sync_driver::SyncServiceObserver: | 39 // sync_driver::SyncServiceObserver: |
38 void OnStateChanged() override; | 40 void OnStateChanged() override; |
39 | 41 |
40 // Loads the |continue_url_| in the |web_contents()|. | 42 // Loads the |continue_url_| in the |web_contents()|. |
41 void LoadContinueUrl(); | 43 void LoadContinueUrl(); |
42 | 44 |
43 // Returns the ProfileSyncService associated with the |web_contents|. | 45 // Returns the ProfileSyncService associated with the |web_contents|. |
44 // The returned value may be NULL. | 46 // The returned value may be NULL. |
45 ProfileSyncService* GetSyncService(content::WebContents* web_contents); | 47 browser_sync::ProfileSyncService* GetSyncService( |
| 48 content::WebContents* web_contents); |
46 | 49 |
47 // Deletes the |observer|. Intended to be used as a callback for base::Bind. | 50 // Deletes the |observer|. Intended to be used as a callback for base::Bind. |
48 static void DeleteObserver( | 51 static void DeleteObserver( |
49 base::WeakPtr<OneClickSigninSyncObserver> observer); | 52 base::WeakPtr<OneClickSigninSyncObserver> observer); |
50 | 53 |
51 // The URL to redirect to once Sync is initialized. | 54 // The URL to redirect to once Sync is initialized. |
52 const GURL continue_url_; | 55 const GURL continue_url_; |
53 | 56 |
54 base::WeakPtrFactory<OneClickSigninSyncObserver> weak_ptr_factory_; | 57 base::WeakPtrFactory<OneClickSigninSyncObserver> weak_ptr_factory_; |
55 | 58 |
56 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncObserver); | 59 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncObserver); |
57 }; | 60 }; |
58 | 61 |
59 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_OBSERVER_H_ | 62 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_OBSERVER_H_ |
OLD | NEW |