OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_UI_IMPL_H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_UI_IMPL_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/compiler_specific.h" | |
12 #include "chrome/browser/api/sync/profile_sync_service_observer.h" | |
13 #include "chrome/browser/extensions/app_notify_channel_ui.h" | |
14 | |
15 class Profile; | |
16 | |
17 namespace content { | |
18 class WebContents; | |
19 } | |
20 | |
21 namespace extensions { | |
22 | |
23 class AppNotifyChannelUIImpl : public AppNotifyChannelUI, | |
24 public ProfileSyncServiceObserver { | |
25 public: | |
26 AppNotifyChannelUIImpl(Profile* profile, | |
27 content::WebContents* web_contents, | |
28 const std::string& app_name, | |
29 AppNotifyChannelUI::UIType ui_type); | |
30 virtual ~AppNotifyChannelUIImpl(); | |
31 | |
32 // AppNotifyChannelUI. | |
33 virtual void PromptSyncSetup(AppNotifyChannelUI::Delegate* delegate) OVERRIDE; | |
34 | |
35 // Called by our InfoBar when it's accepted or cancelled/closed. | |
36 void OnInfoBarResult(bool accepted); | |
37 | |
38 private: | |
39 // ProfileSyncServiceObserver. | |
40 virtual void OnStateChanged() OVERRIDE; | |
41 | |
42 void StartObservingSync(); | |
43 void StopObservingSync(); | |
44 | |
45 Profile* profile_; | |
46 content::WebContents* web_contents_; | |
47 std::string app_name_; | |
48 AppNotifyChannelUI::UIType ui_type_; | |
49 AppNotifyChannelUI::Delegate* delegate_; | |
50 | |
51 // Have we registered ourself as a ProfileSyncServiceObserver? | |
52 bool observing_sync_; | |
53 | |
54 // This is for working around a bug that ProfileSyncService calls | |
55 // ProfileSyncServiceObserver::OnStateChanged callback many times | |
56 // after ShowLoginDialog is called and before the wizard is | |
57 // actually visible to the user. So we record if the wizard was | |
58 // shown to user and then wait for wizard to get dismissed. | |
59 // See crbug.com/101842. | |
60 bool wizard_shown_to_user_; | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(AppNotifyChannelUIImpl); | |
63 }; | |
64 | |
65 } // namespace extensions | |
66 | |
67 #endif // CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_UI_IMPL_H_ | |
OLD | NEW |