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

Side by Side Diff: chrome/browser/chromeos/note_taking_helper.h

Issue 2623273003: arc: Remove ArcServiceManager::Observer (Closed)
Patch Set: Moved Get() to the manager class per (verbal) feedback from Luis Created 3 years, 11 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
OLDNEW
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>
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
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
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
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_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager/event_router.cc ('k') | chrome/browser/chromeos/note_taking_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698