| 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_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ | 5 #ifndef CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ |
| 6 #define CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ | 6 #define CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // are changed. | 44 // are changed. |
| 45 class DefaultClientObserver | 45 class DefaultClientObserver |
| 46 : public ShellIntegration::DefaultWebClientObserver { | 46 : public ShellIntegration::DefaultWebClientObserver { |
| 47 public: | 47 public: |
| 48 explicit DefaultClientObserver(ProtocolHandlerRegistry* registry); | 48 explicit DefaultClientObserver(ProtocolHandlerRegistry* registry); |
| 49 virtual ~DefaultClientObserver(); | 49 virtual ~DefaultClientObserver(); |
| 50 | 50 |
| 51 // Get response from the worker regarding whether Chrome is the default | 51 // Get response from the worker regarding whether Chrome is the default |
| 52 // handler for the protocol. | 52 // handler for the protocol. |
| 53 virtual void SetDefaultWebClientUIState( | 53 virtual void SetDefaultWebClientUIState( |
| 54 ShellIntegration::DefaultWebClientUIState state) OVERRIDE; | 54 ShellIntegration::DefaultWebClientUIState state) override; |
| 55 | 55 |
| 56 virtual bool IsInteractiveSetDefaultPermitted() OVERRIDE; | 56 virtual bool IsInteractiveSetDefaultPermitted() override; |
| 57 | 57 |
| 58 // Give the observer a handle to the worker, so we can find out the protocol | 58 // Give the observer a handle to the worker, so we can find out the protocol |
| 59 // when we're called and also tell the worker if we get deleted. | 59 // when we're called and also tell the worker if we get deleted. |
| 60 void SetWorker(ShellIntegration::DefaultProtocolClientWorker* worker); | 60 void SetWorker(ShellIntegration::DefaultProtocolClientWorker* worker); |
| 61 | 61 |
| 62 protected: | 62 protected: |
| 63 ShellIntegration::DefaultProtocolClientWorker* worker_; | 63 ShellIntegration::DefaultProtocolClientWorker* worker_; |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 virtual bool IsOwnedByWorker() OVERRIDE; | 66 virtual bool IsOwnedByWorker() override; |
| 67 | 67 |
| 68 // This is a raw pointer, not reference counted, intentionally. In general | 68 // This is a raw pointer, not reference counted, intentionally. In general |
| 69 // subclasses of DefaultWebClientObserver are not able to be refcounted | 69 // subclasses of DefaultWebClientObserver are not able to be refcounted |
| 70 // e.g. the browser options page | 70 // e.g. the browser options page |
| 71 ProtocolHandlerRegistry* registry_; | 71 ProtocolHandlerRegistry* registry_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(DefaultClientObserver); | 73 DISALLOW_COPY_AND_ASSIGN(DefaultClientObserver); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 // |Delegate| provides an interface for interacting asynchronously | 76 // |Delegate| provides an interface for interacting asynchronously |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 virtual ~JobInterceptorFactory(); | 108 virtual ~JobInterceptorFactory(); |
| 109 | 109 |
| 110 // |job_factory| is set as the URLRequestJobFactory where requests are | 110 // |job_factory| is set as the URLRequestJobFactory where requests are |
| 111 // forwarded if JobInterceptorFactory decides to pass on them. | 111 // forwarded if JobInterceptorFactory decides to pass on them. |
| 112 void Chain(scoped_ptr<net::URLRequestJobFactory> job_factory); | 112 void Chain(scoped_ptr<net::URLRequestJobFactory> job_factory); |
| 113 | 113 |
| 114 // URLRequestJobFactory implementation. | 114 // URLRequestJobFactory implementation. |
| 115 virtual net::URLRequestJob* MaybeCreateJobWithProtocolHandler( | 115 virtual net::URLRequestJob* MaybeCreateJobWithProtocolHandler( |
| 116 const std::string& scheme, | 116 const std::string& scheme, |
| 117 net::URLRequest* request, | 117 net::URLRequest* request, |
| 118 net::NetworkDelegate* network_delegate) const OVERRIDE; | 118 net::NetworkDelegate* network_delegate) const override; |
| 119 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE; | 119 virtual bool IsHandledProtocol(const std::string& scheme) const override; |
| 120 virtual bool IsHandledURL(const GURL& url) const OVERRIDE; | 120 virtual bool IsHandledURL(const GURL& url) const override; |
| 121 virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE; | 121 virtual bool IsSafeRedirectTarget(const GURL& location) const override; |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 // When JobInterceptorFactory decides to pass on particular requests, | 124 // When JobInterceptorFactory decides to pass on particular requests, |
| 125 // they're forwarded to the chained URLRequestJobFactory, |job_factory_|. | 125 // they're forwarded to the chained URLRequestJobFactory, |job_factory_|. |
| 126 scoped_ptr<URLRequestJobFactory> job_factory_; | 126 scoped_ptr<URLRequestJobFactory> job_factory_; |
| 127 // |io_thread_delegate_| performs the actual job creation decisions by | 127 // |io_thread_delegate_| performs the actual job creation decisions by |
| 128 // mirroring the ProtocolHandlerRegistry on the IO thread. | 128 // mirroring the ProtocolHandlerRegistry on the IO thread. |
| 129 scoped_refptr<IOThreadDelegate> io_thread_delegate_; | 129 scoped_refptr<IOThreadDelegate> io_thread_delegate_; |
| 130 | 130 |
| 131 DISALLOW_COPY_AND_ASSIGN(JobInterceptorFactory); | 131 DISALLOW_COPY_AND_ASSIGN(JobInterceptorFactory); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // Puts this registry in the enabled state - registered protocol handlers | 237 // Puts this registry in the enabled state - registered protocol handlers |
| 238 // will handle requests. | 238 // will handle requests. |
| 239 void Enable(); | 239 void Enable(); |
| 240 | 240 |
| 241 // Puts this registry in the disabled state - registered protocol handlers | 241 // Puts this registry in the disabled state - registered protocol handlers |
| 242 // will not handle requests. | 242 // will not handle requests. |
| 243 void Disable(); | 243 void Disable(); |
| 244 | 244 |
| 245 // This is called by the UI thread when the system is shutting down. This | 245 // This is called by the UI thread when the system is shutting down. This |
| 246 // does finalization which must be done on the UI thread. | 246 // does finalization which must be done on the UI thread. |
| 247 virtual void Shutdown() OVERRIDE; | 247 virtual void Shutdown() override; |
| 248 | 248 |
| 249 // Registers the preferences that we store registered protocol handlers in. | 249 // Registers the preferences that we store registered protocol handlers in. |
| 250 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 250 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 251 | 251 |
| 252 bool enabled() const { return enabled_; } | 252 bool enabled() const { return enabled_; } |
| 253 | 253 |
| 254 // Add a predefined protocol handler. This has to be called before the first | 254 // Add a predefined protocol handler. This has to be called before the first |
| 255 // load command was issued, otherwise the command will be ignored. | 255 // load command was issued, otherwise the command will be ignored. |
| 256 void AddPredefinedHandler(const ProtocolHandler& handler); | 256 void AddPredefinedHandler(const ProtocolHandler& handler); |
| 257 | 257 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 | 376 |
| 377 // Copy of registry data for use on the IO thread. Changes to the registry | 377 // Copy of registry data for use on the IO thread. Changes to the registry |
| 378 // are posted to the IO thread where updates are applied to this object. | 378 // are posted to the IO thread where updates are applied to this object. |
| 379 scoped_refptr<IOThreadDelegate> io_thread_delegate_; | 379 scoped_refptr<IOThreadDelegate> io_thread_delegate_; |
| 380 | 380 |
| 381 DefaultClientObserverList default_client_observers_; | 381 DefaultClientObserverList default_client_observers_; |
| 382 | 382 |
| 383 DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerRegistry); | 383 DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerRegistry); |
| 384 }; | 384 }; |
| 385 #endif // CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ | 385 #endif // CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ |
| OLD | NEW |