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

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

Issue 1233673002: Fix componentization of chrome/browser/bookmarks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix "gn check" and compilation on Mac Created 5 years, 5 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 (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/extensions/chrome_extension_function.h" 14 #include "chrome/browser/extensions/chrome_extension_function.h"
15 #include "components/bookmarks/browser/base_bookmark_model_observer.h" 15 #include "components/bookmarks/browser/base_bookmark_model_observer.h"
16 #include "components/bookmarks/browser/bookmark_node.h" 16 #include "components/bookmarks/browser/bookmark_node.h"
17 #include "extensions/browser/browser_context_keyed_api_factory.h" 17 #include "extensions/browser/browser_context_keyed_api_factory.h"
18 #include "extensions/browser/event_router.h" 18 #include "extensions/browser/event_router.h"
19 #include "ui/shell_dialogs/select_file_dialog.h" 19 #include "ui/shell_dialogs/select_file_dialog.h"
20 20
21 class ChromeBookmarkClient;
22
23 namespace base { 21 namespace base {
24 class FilePath; 22 class FilePath;
25 class ListValue; 23 class ListValue;
26 } 24 }
27 25
26 namespace bookmarks {
27 class BookmarkModel;
28 class ManagedBookmarkService;
29 }
30
28 namespace content { 31 namespace content {
29 class BrowserContext; 32 class BrowserContext;
30 } 33 }
31 34
32 namespace extensions { 35 namespace extensions {
33 36
34 namespace api { 37 namespace api {
35 namespace bookmarks { 38 namespace bookmarks {
36 struct CreateDetails; 39 struct CreateDetails;
37 } 40 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 void ExtensiveBookmarkChangesEnded(bookmarks::BookmarkModel* model) override; 78 void ExtensiveBookmarkChangesEnded(bookmarks::BookmarkModel* model) override;
76 79
77 private: 80 private:
78 // Helper to actually dispatch an event to extension listeners. 81 // Helper to actually dispatch an event to extension listeners.
79 void DispatchEvent(events::HistogramValue histogram_value, 82 void DispatchEvent(events::HistogramValue histogram_value,
80 const std::string& event_name, 83 const std::string& event_name,
81 scoped_ptr<base::ListValue> event_args); 84 scoped_ptr<base::ListValue> event_args);
82 85
83 content::BrowserContext* browser_context_; 86 content::BrowserContext* browser_context_;
84 bookmarks::BookmarkModel* model_; 87 bookmarks::BookmarkModel* model_;
85 ChromeBookmarkClient* client_; 88 bookmarks::ManagedBookmarkService* managed_;
86 89
87 DISALLOW_COPY_AND_ASSIGN(BookmarkEventRouter); 90 DISALLOW_COPY_AND_ASSIGN(BookmarkEventRouter);
88 }; 91 };
89 92
90 class BookmarksAPI : public BrowserContextKeyedAPI, 93 class BookmarksAPI : public BrowserContextKeyedAPI,
91 public EventRouter::Observer { 94 public EventRouter::Observer {
92 public: 95 public:
93 explicit BookmarksAPI(content::BrowserContext* context); 96 explicit BookmarksAPI(content::BrowserContext* context);
94 ~BookmarksAPI() override; 97 ~BookmarksAPI() override;
95 98
(...skipping 29 matching lines...) Expand all
125 128
126 protected: 129 protected:
127 ~BookmarksFunction() override {} 130 ~BookmarksFunction() override {}
128 131
129 // RunAsync semantic equivalent called when the bookmarks are ready. 132 // RunAsync semantic equivalent called when the bookmarks are ready.
130 virtual bool RunOnReady() = 0; 133 virtual bool RunOnReady() = 0;
131 134
132 // Helper to get the BookmarkModel. 135 // Helper to get the BookmarkModel.
133 bookmarks::BookmarkModel* GetBookmarkModel(); 136 bookmarks::BookmarkModel* GetBookmarkModel();
134 137
135 // Helper to get the ChromeBookmarkClient. 138 // Helper to get the ManagedBookmarkService.
136 ChromeBookmarkClient* GetChromeBookmarkClient(); 139 bookmarks::ManagedBookmarkService* GetManagedBookmarkService();
137 140
138 // Helper to get the bookmark id as int64 from the given string id. 141 // Helper to get the bookmark id as int64 from the given string id.
139 // Sets error_ to an error string if the given id string can't be parsed 142 // Sets error_ to an error string if the given id string can't be parsed
140 // as an int64. In case of error, doesn't change id and returns false. 143 // as an int64. In case of error, doesn't change id and returns false.
141 bool GetBookmarkIdAsInt64(const std::string& id_string, int64* id); 144 bool GetBookmarkIdAsInt64(const std::string& id_string, int64* id);
142 145
143 // Helper to get the bookmark node from a given string id. 146 // Helper to get the bookmark node from a given string id.
144 // If the given id can't be parsed or doesn't refer to a valid node, sets 147 // If the given id can't be parsed or doesn't refer to a valid node, sets
145 // error_ and returns NULL. 148 // error_ and returns NULL.
146 const bookmarks::BookmarkNode* GetBookmarkNodeFromId( 149 const bookmarks::BookmarkNode* GetBookmarkNodeFromId(
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 private: 363 private:
361 ~BookmarksExportFunction() override {} 364 ~BookmarksExportFunction() override {}
362 365
363 // BookmarksFunction: 366 // BookmarksFunction:
364 bool RunOnReady() override; 367 bool RunOnReady() override;
365 }; 368 };
366 369
367 } // namespace extensions 370 } // namespace extensions
368 371
369 #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ 372 #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/bookmarks/bookmark_apitest.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