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

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

Issue 1203713002: Limit access to ChromeBookmarkClient to bookmarks code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup_bookmark_client
Patch Set: Rebase Created 5 years, 6 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
28 namespace content { 26 namespace content {
29 class BrowserContext; 27 class BrowserContext;
30 } 28 }
31 29
32 namespace extensions { 30 namespace extensions {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 bookmarks::BookmarkModel* model) override; 72 bookmarks::BookmarkModel* model) override;
75 void ExtensiveBookmarkChangesEnded(bookmarks::BookmarkModel* model) override; 73 void ExtensiveBookmarkChangesEnded(bookmarks::BookmarkModel* model) override;
76 74
77 private: 75 private:
78 // Helper to actually dispatch an event to extension listeners. 76 // Helper to actually dispatch an event to extension listeners.
79 void DispatchEvent(const std::string& event_name, 77 void DispatchEvent(const std::string& event_name,
80 scoped_ptr<base::ListValue> event_args); 78 scoped_ptr<base::ListValue> event_args);
81 79
82 content::BrowserContext* browser_context_; 80 content::BrowserContext* browser_context_;
83 bookmarks::BookmarkModel* model_; 81 bookmarks::BookmarkModel* model_;
84 ChromeBookmarkClient* client_;
85 82
86 DISALLOW_COPY_AND_ASSIGN(BookmarkEventRouter); 83 DISALLOW_COPY_AND_ASSIGN(BookmarkEventRouter);
87 }; 84 };
88 85
89 class BookmarksAPI : public BrowserContextKeyedAPI, 86 class BookmarksAPI : public BrowserContextKeyedAPI,
90 public EventRouter::Observer { 87 public EventRouter::Observer {
91 public: 88 public:
92 explicit BookmarksAPI(content::BrowserContext* context); 89 explicit BookmarksAPI(content::BrowserContext* context);
93 ~BookmarksAPI() override; 90 ~BookmarksAPI() override;
94 91
(...skipping 29 matching lines...) Expand all
124 121
125 protected: 122 protected:
126 ~BookmarksFunction() override {} 123 ~BookmarksFunction() override {}
127 124
128 // RunAsync semantic equivalent called when the bookmarks are ready. 125 // RunAsync semantic equivalent called when the bookmarks are ready.
129 virtual bool RunOnReady() = 0; 126 virtual bool RunOnReady() = 0;
130 127
131 // Helper to get the BookmarkModel. 128 // Helper to get the BookmarkModel.
132 bookmarks::BookmarkModel* GetBookmarkModel(); 129 bookmarks::BookmarkModel* GetBookmarkModel();
133 130
134 // Helper to get the ChromeBookmarkClient.
135 ChromeBookmarkClient* GetChromeBookmarkClient();
136
137 // Helper to get the bookmark id as int64 from the given string id. 131 // Helper to get the bookmark id as int64 from the given string id.
138 // Sets error_ to an error string if the given id string can't be parsed 132 // Sets error_ to an error string if the given id string can't be parsed
139 // as an int64. In case of error, doesn't change id and returns false. 133 // as an int64. In case of error, doesn't change id and returns false.
140 bool GetBookmarkIdAsInt64(const std::string& id_string, int64* id); 134 bool GetBookmarkIdAsInt64(const std::string& id_string, int64* id);
141 135
142 // Helper to get the bookmark node from a given string id. 136 // Helper to get the bookmark node from a given string id.
143 // If the given id can't be parsed or doesn't refer to a valid node, sets 137 // If the given id can't be parsed or doesn't refer to a valid node, sets
144 // error_ and returns NULL. 138 // error_ and returns NULL.
145 const bookmarks::BookmarkNode* GetBookmarkNodeFromId( 139 const bookmarks::BookmarkNode* GetBookmarkNodeFromId(
146 const std::string& id_string); 140 const std::string& id_string);
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 private: 353 private:
360 ~BookmarksExportFunction() override {} 354 ~BookmarksExportFunction() override {}
361 355
362 // BookmarksFunction: 356 // BookmarksFunction:
363 bool RunOnReady() override; 357 bool RunOnReady() override;
364 }; 358 };
365 359
366 } // namespace extensions 360 } // namespace extensions
367 361
368 #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ 362 #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698