OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CHROMEOS_NOTE_TAKING_HELPER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NOTE_TAKING_HELPER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_NOTE_TAKING_HELPER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NOTE_TAKING_HELPER_H_ |
7 | 7 |
8 #include <memory> | |
Yusuke Sato
2017/01/11 23:12:38
This is for removing an IWYU warning from git-cl l
| |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
13 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
14 #include "base/scoped_observer.h" | 15 #include "base/scoped_observer.h" |
15 #include "chrome/browser/chromeos/arc/arc_session_manager.h" | 16 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
16 #include "components/arc/arc_service_manager.h" | 17 #include "components/arc/common/intent_helper.mojom.h" |
18 #include "components/arc/intent_helper/arc_intent_helper_observer.h" | |
17 #include "content/public/browser/notification_details.h" | 19 #include "content/public/browser/notification_details.h" |
18 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
20 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
21 #include "extensions/browser/extension_registry_observer.h" | 23 #include "extensions/browser/extension_registry_observer.h" |
22 #include "extensions/common/extension.h" | 24 #include "extensions/common/extension.h" |
23 | 25 |
24 class Profile; | 26 class Profile; |
25 | 27 |
26 namespace base { | 28 namespace base { |
(...skipping 24 matching lines...) Expand all Loading... | |
51 // the case of an Android app). | 53 // the case of an Android app). |
52 std::string app_id; | 54 std::string app_id; |
53 | 55 |
54 // True if this is the preferred note-taking app. | 56 // True if this is the preferred note-taking app. |
55 bool preferred; | 57 bool preferred; |
56 }; | 58 }; |
57 | 59 |
58 using NoteTakingAppInfos = std::vector<NoteTakingAppInfo>; | 60 using NoteTakingAppInfos = std::vector<NoteTakingAppInfo>; |
59 | 61 |
60 // Singleton class used to launch a note-taking app. | 62 // Singleton class used to launch a note-taking app. |
61 class NoteTakingHelper : public arc::ArcServiceManager::Observer, | 63 class NoteTakingHelper : public arc::ArcIntentHelperObserver, |
62 public arc::ArcSessionManager::Observer, | 64 public arc::ArcSessionManager::Observer, |
63 public content::NotificationObserver, | 65 public content::NotificationObserver, |
64 public extensions::ExtensionRegistryObserver { | 66 public extensions::ExtensionRegistryObserver { |
65 public: | 67 public: |
66 // Interface for observing changes to the list of available apps. | 68 // Interface for observing changes to the list of available apps. |
67 class Observer { | 69 class Observer { |
68 public: | 70 public: |
69 virtual ~Observer() = default; | 71 virtual ~Observer() = default; |
70 | 72 |
71 // Called when the list of available apps that will be returned by | 73 // Called when the list of available apps that will be returned by |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 | 145 |
144 // Returns true if an app that can be used to take notes is available. UI | 146 // Returns true if an app that can be used to take notes is available. UI |
145 // surfaces that call LaunchAppForNewNote() should be hidden otherwise. | 147 // surfaces that call LaunchAppForNewNote() should be hidden otherwise. |
146 bool IsAppAvailable(Profile* profile); | 148 bool IsAppAvailable(Profile* profile); |
147 | 149 |
148 // Launches the note-taking app to create a new note, optionally additionally | 150 // Launches the note-taking app to create a new note, optionally additionally |
149 // passing a file (|path| may be empty). IsAppAvailable() must be called | 151 // passing a file (|path| may be empty). IsAppAvailable() must be called |
150 // first. | 152 // first. |
151 void LaunchAppForNewNote(Profile* profile, const base::FilePath& path); | 153 void LaunchAppForNewNote(Profile* profile, const base::FilePath& path); |
152 | 154 |
153 // arc::ArcServiceManager::Observer: | 155 // arc::ArcIntentHelperObserver: |
154 void OnIntentFiltersUpdated() override; | 156 void OnIntentFiltersUpdated() override; |
155 | 157 |
156 // arc::ArcSessionManager::Observer: | 158 // arc::ArcSessionManager::Observer: |
157 void OnArcOptInChanged(bool enabled) override; | 159 void OnArcOptInChanged(bool enabled) override; |
158 | 160 |
159 private: | 161 private: |
160 NoteTakingHelper(); | 162 NoteTakingHelper(); |
161 ~NoteTakingHelper() override; | 163 ~NoteTakingHelper() override; |
162 | 164 |
163 // Returns true if |extension| is a whitelisted note-taking app and false | 165 // Returns true if |extension| is a whitelisted note-taking app and false |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 content::NotificationRegistrar registrar_; | 228 content::NotificationRegistrar registrar_; |
227 | 229 |
228 base::WeakPtrFactory<NoteTakingHelper> weak_ptr_factory_; | 230 base::WeakPtrFactory<NoteTakingHelper> weak_ptr_factory_; |
229 | 231 |
230 DISALLOW_COPY_AND_ASSIGN(NoteTakingHelper); | 232 DISALLOW_COPY_AND_ASSIGN(NoteTakingHelper); |
231 }; | 233 }; |
232 | 234 |
233 } // namespace chromeos | 235 } // namespace chromeos |
234 | 236 |
235 #endif // CHROME_BROWSER_CHROMEOS_NOTE_TAKING_HELPER_H_ | 237 #endif // CHROME_BROWSER_CHROMEOS_NOTE_TAKING_HELPER_H_ |
OLD | NEW |