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

Side by Side Diff: chrome/browser/extensions/api/bookmarks/bookmarks_api.h

Issue 178193030: Rename ProfileKeyedAPI to BrowserContextKeyedAPI and GetProfile to Get. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
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_API_BOOKMARKS_BOOKMARKS_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "chrome/browser/bookmarks/base_bookmark_model_observer.h" 14 #include "chrome/browser/bookmarks/base_bookmark_model_observer.h"
15 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
16 #include "chrome/browser/extensions/chrome_extension_function.h" 15 #include "chrome/browser/extensions/chrome_extension_function.h"
16 #include "extensions/browser/browser_context_keyed_api_factory.h"
17 #include "extensions/browser/event_router.h" 17 #include "extensions/browser/event_router.h"
18 #include "ui/shell_dialogs/select_file_dialog.h" 18 #include "ui/shell_dialogs/select_file_dialog.h"
19 19
20 namespace base { 20 namespace base {
21 class FilePath; 21 class FilePath;
22 class ListValue; 22 class ListValue;
23 } 23 }
24 24
25 namespace content { 25 namespace content {
26 class BrowserContext; 26 class BrowserContext;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // Helper to actually dispatch an event to extension listeners. 65 // Helper to actually dispatch an event to extension listeners.
66 void DispatchEvent(const std::string& event_name, 66 void DispatchEvent(const std::string& event_name,
67 scoped_ptr<base::ListValue> event_args); 67 scoped_ptr<base::ListValue> event_args);
68 68
69 content::BrowserContext* browser_context_; 69 content::BrowserContext* browser_context_;
70 BookmarkModel* model_; 70 BookmarkModel* model_;
71 71
72 DISALLOW_COPY_AND_ASSIGN(BookmarkEventRouter); 72 DISALLOW_COPY_AND_ASSIGN(BookmarkEventRouter);
73 }; 73 };
74 74
75 class BookmarksAPI : public ProfileKeyedAPI, 75 class BookmarksAPI : public BrowserContextKeyedAPI,
76 public EventRouter::Observer { 76 public EventRouter::Observer {
77 public: 77 public:
78 explicit BookmarksAPI(content::BrowserContext* context); 78 explicit BookmarksAPI(content::BrowserContext* context);
79 virtual ~BookmarksAPI(); 79 virtual ~BookmarksAPI();
80 80
81 // BrowserContextKeyedService implementation. 81 // BrowserContextKeyedService implementation.
82 virtual void Shutdown() OVERRIDE; 82 virtual void Shutdown() OVERRIDE;
83 83
84 // ProfileKeyedAPI implementation. 84 // BrowserContextKeyedAPI implementation.
85 static ProfileKeyedAPIFactory<BookmarksAPI>* GetFactoryInstance(); 85 static BrowserContextKeyedAPIFactory<BookmarksAPI>* GetFactoryInstance();
86 86
87 // EventRouter::Observer implementation. 87 // EventRouter::Observer implementation.
88 virtual void OnListenerAdded( 88 virtual void OnListenerAdded(
89 const EventListenerInfo& details) OVERRIDE; 89 const EventListenerInfo& details) OVERRIDE;
90 90
91 private: 91 private:
92 friend class ProfileKeyedAPIFactory<BookmarksAPI>; 92 friend class BrowserContextKeyedAPIFactory<BookmarksAPI>;
93 93
94 content::BrowserContext* browser_context_; 94 content::BrowserContext* browser_context_;
95 95
96 // ProfileKeyedAPI implementation. 96 // BrowserContextKeyedAPI implementation.
97 static const char* service_name() { 97 static const char* service_name() {
98 return "BookmarksAPI"; 98 return "BookmarksAPI";
99 } 99 }
100 static const bool kServiceIsNULLWhileTesting = true; 100 static const bool kServiceIsNULLWhileTesting = true;
101 101
102 // Created lazily upon OnListenerAdded. 102 // Created lazily upon OnListenerAdded.
103 scoped_ptr<BookmarkEventRouter> bookmark_event_router_; 103 scoped_ptr<BookmarkEventRouter> bookmark_event_router_;
104 }; 104 };
105 105
106 class BookmarksFunction : public ChromeAsyncExtensionFunction, 106 class BookmarksFunction : public ChromeAsyncExtensionFunction,
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 private: 334 private:
335 virtual ~BookmarksExportFunction() {} 335 virtual ~BookmarksExportFunction() {}
336 336
337 // ExtensionFunction: 337 // ExtensionFunction:
338 virtual bool RunImpl() OVERRIDE; 338 virtual bool RunImpl() OVERRIDE;
339 }; 339 };
340 340
341 } // namespace extensions 341 } // namespace extensions
342 342
343 #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ 343 #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/bluetooth/bluetooth_api.cc ('k') | chrome/browser/extensions/api/bookmarks/bookmarks_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698