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 #ifndef CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_UI_IMPL_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_UI_IMPL_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_UI_IMPL_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_UI_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 public: | 25 public: |
26 AppNotifyChannelUIImpl(Profile* profile, | 26 AppNotifyChannelUIImpl(Profile* profile, |
27 content::WebContents* web_contents, | 27 content::WebContents* web_contents, |
28 const std::string& app_name, | 28 const std::string& app_name, |
29 AppNotifyChannelUI::UIType ui_type); | 29 AppNotifyChannelUI::UIType ui_type); |
30 virtual ~AppNotifyChannelUIImpl(); | 30 virtual ~AppNotifyChannelUIImpl(); |
31 | 31 |
32 // AppNotifyChannelUI. | 32 // AppNotifyChannelUI. |
33 virtual void PromptSyncSetup(AppNotifyChannelUI::Delegate* delegate) OVERRIDE; | 33 virtual void PromptSyncSetup(AppNotifyChannelUI::Delegate* delegate) OVERRIDE; |
34 | 34 |
35 protected: | |
36 // A private class we use to put up an infobar - its lifetime is managed by | |
37 // |web_contents_|, so we don't have one as an instance variable. | |
38 class InfoBar; | |
39 friend class AppNotifyChannelUIImpl::InfoBar; | |
40 | |
41 // Called by our InfoBar when it's accepted or cancelled/closed. | 35 // Called by our InfoBar when it's accepted or cancelled/closed. |
42 void OnInfoBarResult(bool accepted); | 36 void OnInfoBarResult(bool accepted); |
43 | 37 |
| 38 private: |
44 // ProfileSyncServiceObserver. | 39 // ProfileSyncServiceObserver. |
45 virtual void OnStateChanged() OVERRIDE; | 40 virtual void OnStateChanged() OVERRIDE; |
46 | 41 |
47 private: | |
48 void StartObservingSync(); | 42 void StartObservingSync(); |
49 void StopObservingSync(); | 43 void StopObservingSync(); |
50 | 44 |
51 Profile* profile_; | 45 Profile* profile_; |
52 content::WebContents* web_contents_; | 46 content::WebContents* web_contents_; |
53 std::string app_name_; | 47 std::string app_name_; |
54 AppNotifyChannelUI::UIType ui_type_; | 48 AppNotifyChannelUI::UIType ui_type_; |
55 AppNotifyChannelUI::Delegate* delegate_; | 49 AppNotifyChannelUI::Delegate* delegate_; |
56 | 50 |
57 // Have we registered ourself as a ProfileSyncServiceObserver? | 51 // Have we registered ourself as a ProfileSyncServiceObserver? |
58 bool observing_sync_; | 52 bool observing_sync_; |
59 | 53 |
60 // This is for working around a bug that ProfileSyncService calls | 54 // This is for working around a bug that ProfileSyncService calls |
61 // ProfileSyncServiceObserver::OnStateChanged callback many times | 55 // ProfileSyncServiceObserver::OnStateChanged callback many times |
62 // after ShowLoginDialog is called and before the wizard is | 56 // after ShowLoginDialog is called and before the wizard is |
63 // actually visible to the user. So we record if the wizard was | 57 // actually visible to the user. So we record if the wizard was |
64 // shown to user and then wait for wizard to get dismissed. | 58 // shown to user and then wait for wizard to get dismissed. |
65 // See crbug.com/101842. | 59 // See crbug.com/101842. |
66 bool wizard_shown_to_user_; | 60 bool wizard_shown_to_user_; |
67 | 61 |
68 DISALLOW_COPY_AND_ASSIGN(AppNotifyChannelUIImpl); | 62 DISALLOW_COPY_AND_ASSIGN(AppNotifyChannelUIImpl); |
69 }; | 63 }; |
70 | 64 |
71 } // namespace extensions | 65 } // namespace extensions |
72 | 66 |
73 #endif // CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_UI_IMPL_H_ | 67 #endif // CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_UI_IMPL_H_ |
OLD | NEW |