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

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

Issue 7693004: Added tracking of time spent waiting on extensions to the webRequest API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile Created 9 years, 4 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_webrequest_api.cc » ('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_WEBREQUEST_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "chrome/browser/extensions/extension_function.h" 16 #include "chrome/browser/extensions/extension_function.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/common/extensions/url_pattern_set.h" 18 #include "chrome/common/extensions/url_pattern_set.h"
19 #include "ipc/ipc_message.h" 19 #include "ipc/ipc_message.h"
20 #include "net/base/completion_callback.h" 20 #include "net/base/completion_callback.h"
21 #include "net/http/http_request_headers.h" 21 #include "net/http/http_request_headers.h"
22 #include "webkit/glue/resource_type.h" 22 #include "webkit/glue/resource_type.h"
23 23
24 class ExtensionInfoMap; 24 class ExtensionInfoMap;
25 class ExtensionWebRequestTimeTracker;
25 class GURL; 26 class GURL;
26 27
27 namespace base { 28 namespace base {
28 class DictionaryValue; 29 class DictionaryValue;
29 class ListValue; 30 class ListValue;
30 class StringValue; 31 class StringValue;
31 } 32 }
32 33
33 namespace net { 34 namespace net {
34 class AuthChallengeInfo; 35 class AuthChallengeInfo;
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 std::vector<const ExtensionWebRequestEventRouter::EventListener*>* 295 std::vector<const ExtensionWebRequestEventRouter::EventListener*>*
295 matching_listeners); 296 matching_listeners);
296 297
297 // Decrements the count of event handlers blocking the given request. When the 298 // Decrements the count of event handlers blocking the given request. When the
298 // count reaches 0, we stop blocking the request and proceed it using the 299 // count reaches 0, we stop blocking the request and proceed it using the
299 // method requested by the extension with the highest precedence. Precedence 300 // method requested by the extension with the highest precedence. Precedence
300 // is decided by extension install time. If |response| is non-NULL, this 301 // is decided by extension install time. If |response| is non-NULL, this
301 // method assumes ownership. 302 // method assumes ownership.
302 void DecrementBlockCount( 303 void DecrementBlockCount(
303 void* profile, 304 void* profile,
305 const std::string& extension_id,
304 const std::string& event_name, 306 const std::string& event_name,
305 uint64 request_id, 307 uint64 request_id,
306 EventResponse* response); 308 EventResponse* response);
307 309
308 // Sets the flag that |event_type| has been signaled for |request_id|. 310 // Sets the flag that |event_type| has been signaled for |request_id|.
309 // Returns the value of the flag before setting it. 311 // Returns the value of the flag before setting it.
310 bool GetAndSetSignaled(uint64 request_id, EventTypes event_type); 312 bool GetAndSetSignaled(uint64 request_id, EventTypes event_type);
311 313
312 // Clears the flag that |event_type| has been signaled for |request_id|. 314 // Clears the flag that |event_type| has been signaled for |request_id|.
313 void ClearSignaled(uint64 request_id, EventTypes event_type); 315 void ClearSignaled(uint64 request_id, EventTypes event_type);
(...skipping 28 matching lines...) Expand all
342 BlockedRequestMap blocked_requests_; 344 BlockedRequestMap blocked_requests_;
343 345
344 // A map of request ids to a bitvector indicating which events have been 346 // A map of request ids to a bitvector indicating which events have been
345 // signaled and should not be sent again. 347 // signaled and should not be sent again.
346 SignaledRequestMap signaled_requests_; 348 SignaledRequestMap signaled_requests_;
347 349
348 // A map of original profile -> corresponding incognito profile (and vice 350 // A map of original profile -> corresponding incognito profile (and vice
349 // versa). 351 // versa).
350 CrossProfileMap cross_profile_map_; 352 CrossProfileMap cross_profile_map_;
351 353
354 // Keeps track of time spent waiting on extensions using the blocking
355 // webRequest API.
356 scoped_ptr<ExtensionWebRequestTimeTracker> request_time_tracker_;
357
352 DISALLOW_COPY_AND_ASSIGN(ExtensionWebRequestEventRouter); 358 DISALLOW_COPY_AND_ASSIGN(ExtensionWebRequestEventRouter);
353 }; 359 };
354 360
355 class WebRequestAddEventListener : public SyncIOThreadExtensionFunction { 361 class WebRequestAddEventListener : public SyncIOThreadExtensionFunction {
356 public: 362 public:
357 virtual bool RunImpl(); 363 virtual bool RunImpl();
358 DECLARE_EXTENSION_FUNCTION_NAME("experimental.webRequest.addEventListener"); 364 DECLARE_EXTENSION_FUNCTION_NAME("experimental.webRequest.addEventListener");
359 }; 365 };
360 366
361 class WebRequestEventHandled : public SyncIOThreadExtensionFunction { 367 class WebRequestEventHandled : public SyncIOThreadExtensionFunction {
362 public: 368 public:
363 virtual bool RunImpl(); 369 virtual bool RunImpl();
364 DECLARE_EXTENSION_FUNCTION_NAME("experimental.webRequest.eventHandled"); 370 DECLARE_EXTENSION_FUNCTION_NAME("experimental.webRequest.eventHandled");
365 }; 371 };
366 372
367 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ 373 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_webrequest_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698