| OLD | NEW |
| 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_WEB_REQUEST_WEB_REQUEST_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 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/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" | 17 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" |
| 18 #include "chrome/browser/extensions/api/declarative_webrequest/request_stage.h" | 18 #include "chrome/browser/extensions/api/declarative_webrequest/request_stage.h" |
| 19 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" | |
| 20 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h" | 19 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h" |
| 21 #include "chrome/browser/extensions/api/web_request/web_request_permissions.h" | 20 #include "chrome/browser/extensions/api/web_request/web_request_permissions.h" |
| 21 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 22 #include "extensions/browser/event_router.h" | 22 #include "extensions/browser/event_router.h" |
| 23 #include "extensions/browser/extension_function.h" | 23 #include "extensions/browser/extension_function.h" |
| 24 #include "extensions/common/url_pattern_set.h" | 24 #include "extensions/common/url_pattern_set.h" |
| 25 #include "ipc/ipc_sender.h" | 25 #include "ipc/ipc_sender.h" |
| 26 #include "net/base/completion_callback.h" | 26 #include "net/base/completion_callback.h" |
| 27 #include "net/base/network_delegate.h" | 27 #include "net/base/network_delegate.h" |
| 28 #include "net/http/http_request_headers.h" | 28 #include "net/http/http_request_headers.h" |
| 29 #include "webkit/common/resource_type.h" | 29 #include "webkit/common/resource_type.h" |
| 30 | 30 |
| 31 class ExtensionWebRequestTimeTracker; | 31 class ExtensionWebRequestTimeTracker; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 52 | 52 |
| 53 namespace extensions { | 53 namespace extensions { |
| 54 | 54 |
| 55 class InfoMap; | 55 class InfoMap; |
| 56 class WebRequestRulesRegistry; | 56 class WebRequestRulesRegistry; |
| 57 | 57 |
| 58 // Support class for the WebRequest API. Lives on the UI thread. Most of the | 58 // Support class for the WebRequest API. Lives on the UI thread. Most of the |
| 59 // work is done by ExtensionWebRequestEventRouter below. This class observes | 59 // work is done by ExtensionWebRequestEventRouter below. This class observes |
| 60 // extension::EventRouter to deal with event listeners. There is one instance | 60 // extension::EventRouter to deal with event listeners. There is one instance |
| 61 // per BrowserContext which is shared with incognito. | 61 // per BrowserContext which is shared with incognito. |
| 62 class WebRequestAPI : public ProfileKeyedAPI, | 62 class WebRequestAPI : public BrowserContextKeyedAPI, |
| 63 public EventRouter::Observer { | 63 public EventRouter::Observer { |
| 64 public: | 64 public: |
| 65 explicit WebRequestAPI(content::BrowserContext* context); | 65 explicit WebRequestAPI(content::BrowserContext* context); |
| 66 virtual ~WebRequestAPI(); | 66 virtual ~WebRequestAPI(); |
| 67 | 67 |
| 68 // ProfileKeyedAPI support: | 68 // BrowserContextKeyedAPI support: |
| 69 static ProfileKeyedAPIFactory<WebRequestAPI>* GetFactoryInstance(); | 69 static BrowserContextKeyedAPIFactory<WebRequestAPI>* GetFactoryInstance(); |
| 70 | 70 |
| 71 // EventRouter::Observer overrides: | 71 // EventRouter::Observer overrides: |
| 72 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; | 72 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 friend class ProfileKeyedAPIFactory<WebRequestAPI>; | 75 friend class BrowserContextKeyedAPIFactory<WebRequestAPI>; |
| 76 | 76 |
| 77 // ProfileKeyedAPI support: | 77 // BrowserContextKeyedAPI support: |
| 78 static const char* service_name() { return "WebRequestAPI"; } | 78 static const char* service_name() { return "WebRequestAPI"; } |
| 79 static const bool kServiceRedirectedInIncognito = true; | 79 static const bool kServiceRedirectedInIncognito = true; |
| 80 static const bool kServiceIsNULLWhileTesting = true; | 80 static const bool kServiceIsNULLWhileTesting = true; |
| 81 | 81 |
| 82 content::BrowserContext* browser_context_; | 82 content::BrowserContext* browser_context_; |
| 83 | 83 |
| 84 DISALLOW_COPY_AND_ASSIGN(WebRequestAPI); | 84 DISALLOW_COPY_AND_ASSIGN(WebRequestAPI); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 } // namespace extensions | 87 } // namespace extensions |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 virtual void OnQuotaExceeded(const std::string& error) OVERRIDE; | 507 virtual void OnQuotaExceeded(const std::string& error) OVERRIDE; |
| 508 virtual bool RunImpl() OVERRIDE; | 508 virtual bool RunImpl() OVERRIDE; |
| 509 }; | 509 }; |
| 510 | 510 |
| 511 // Send updates to |host| with information about what webRequest-related | 511 // Send updates to |host| with information about what webRequest-related |
| 512 // extensions are installed. | 512 // extensions are installed. |
| 513 // TODO(mpcomplete): remove. http://crbug.com/100411 | 513 // TODO(mpcomplete): remove. http://crbug.com/100411 |
| 514 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); | 514 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); |
| 515 | 515 |
| 516 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 516 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
| OLD | NEW |