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

Side by Side Diff: chrome/browser/extensions/extension_function.h

Issue 6990050: Small cleanup to move ExtensionFunctionDispatcher to use WeakPtr instead of Peer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_function_dispatcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_EXTENSION_FUNCTION_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <list> 10 #include <list>
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 virtual const std::string GetResult() = 0; 74 virtual const std::string GetResult() = 0;
75 75
76 // Retrieves any error string from the function. 76 // Retrieves any error string from the function.
77 virtual const std::string GetError() = 0; 77 virtual const std::string GetError() = 0;
78 78
79 // Returns a quota limit heuristic suitable for this function. 79 // Returns a quota limit heuristic suitable for this function.
80 // No quota limiting by default. 80 // No quota limiting by default.
81 virtual void GetQuotaLimitHeuristics( 81 virtual void GetQuotaLimitHeuristics(
82 std::list<QuotaLimitHeuristic*>* heuristics) const {} 82 std::list<QuotaLimitHeuristic*>* heuristics) const {}
83 83
84 void set_dispatcher_peer(ExtensionFunctionDispatcher::Peer* peer) { 84 void set_dispatcher(
85 peer_ = peer; 85 const base::WeakPtr<ExtensionFunctionDispatcher>& dispatcher) {
86 dispatcher_ = dispatcher;
86 } 87 }
87 ExtensionFunctionDispatcher* dispatcher() const { 88 ExtensionFunctionDispatcher* dispatcher() const {
88 return peer_->dispatcher_; 89 return dispatcher_.get();
89 } 90 }
90 91
91 void set_request_id(int request_id) { request_id_ = request_id; } 92 void set_request_id(int request_id) { request_id_ = request_id; }
92 int request_id() { return request_id_; } 93 int request_id() { return request_id_; }
93 94
94 void set_source_url(const GURL& source_url) { source_url_ = source_url; } 95 void set_source_url(const GURL& source_url) { source_url_ = source_url; }
95 const GURL& source_url() { return source_url_; } 96 const GURL& source_url() { return source_url_; }
96 97
97 void set_has_callback(bool has_callback) { has_callback_ = has_callback; } 98 void set_has_callback(bool has_callback) { has_callback_ = has_callback; }
98 bool has_callback() { return has_callback_; } 99 bool has_callback() { return has_callback_; }
(...skipping 29 matching lines...) Expand all
128 // foremost one. 129 // foremost one.
129 // 130 //
130 // Incognito browsers are not considered unless the calling extension has 131 // Incognito browsers are not considered unless the calling extension has
131 // incognito access enabled. 132 // incognito access enabled.
132 // 133 //
133 // This method can return NULL if there is no matching browser, which can 134 // This method can return NULL if there is no matching browser, which can
134 // happen if only incognito windows are open, or early in startup or shutdown 135 // happen if only incognito windows are open, or early in startup or shutdown
135 // shutdown when there are no active windows. 136 // shutdown when there are no active windows.
136 Browser* GetCurrentBrowser(); 137 Browser* GetCurrentBrowser();
137 138
138 // The peer to the dispatcher that will service this extension function call. 139 // The dispatcher that will service this extension function call.
139 scoped_refptr<ExtensionFunctionDispatcher::Peer> peer_; 140 base::WeakPtr<ExtensionFunctionDispatcher> dispatcher_;
140 141
141 // The RenderViewHost we will send responses too. 142 // The RenderViewHost we will send responses too.
142 RenderViewHost* render_view_host_; 143 RenderViewHost* render_view_host_;
143 144
144 // Id of this request, used to map the response back to the caller. 145 // Id of this request, used to map the response back to the caller.
145 int request_id_; 146 int request_id_;
146 147
147 // The Profile of this function's extension. 148 // The Profile of this function's extension.
148 Profile* profile_; 149 Profile* profile_;
149 150
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 virtual void Run(); 264 virtual void Run();
264 265
265 protected: 266 protected:
266 virtual ~SyncExtensionFunction(); 267 virtual ~SyncExtensionFunction();
267 268
268 private: 269 private:
269 DISALLOW_COPY_AND_ASSIGN(SyncExtensionFunction); 270 DISALLOW_COPY_AND_ASSIGN(SyncExtensionFunction);
270 }; 271 };
271 272
272 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ 273 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_function_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698