OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/component_updater/component_updater_resource_throttle.h
" | 5 #include "chrome/browser/component_updater/component_updater_resource_throttle.h
" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "components/component_updater/component_updater_service.h" | 9 #include "components/component_updater/component_updater_service.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // unless the CrxUpdateService calls Unblock(). | 24 // unless the CrxUpdateService calls Unblock(). |
25 // The lifetime is controlled by Chrome's resource loader so the component | 25 // The lifetime is controlled by Chrome's resource loader so the component |
26 // updater cannot touch objects from this class except via weak pointers. | 26 // updater cannot touch objects from this class except via weak pointers. |
27 class CUResourceThrottle : public content::ResourceThrottle, | 27 class CUResourceThrottle : public content::ResourceThrottle, |
28 public base::SupportsWeakPtr<CUResourceThrottle> { | 28 public base::SupportsWeakPtr<CUResourceThrottle> { |
29 public: | 29 public: |
30 CUResourceThrottle(); | 30 CUResourceThrottle(); |
31 virtual ~CUResourceThrottle(); | 31 virtual ~CUResourceThrottle(); |
32 | 32 |
33 // Overriden from ResourceThrottle. | 33 // Overriden from ResourceThrottle. |
34 virtual void WillStartRequest(bool* defer) OVERRIDE; | 34 virtual void WillStartRequest(bool* defer) override; |
35 virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE; | 35 virtual void WillRedirectRequest(const GURL& new_url, bool* defer) override; |
36 virtual const char* GetNameForLogging() const OVERRIDE; | 36 virtual const char* GetNameForLogging() const override; |
37 | 37 |
38 // Component updater calls this function via PostTask to unblock the request. | 38 // Component updater calls this function via PostTask to unblock the request. |
39 void Unblock(); | 39 void Unblock(); |
40 | 40 |
41 typedef std::vector<base::WeakPtr<CUResourceThrottle> > WeakPtrVector; | 41 typedef std::vector<base::WeakPtr<CUResourceThrottle> > WeakPtrVector; |
42 | 42 |
43 private: | 43 private: |
44 enum State { NEW, BLOCKED, UNBLOCKED }; | 44 enum State { NEW, BLOCKED, UNBLOCKED }; |
45 | 45 |
46 State state_; | 46 State state_; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 BrowserThread::UI, | 99 BrowserThread::UI, |
100 FROM_HERE, | 100 FROM_HERE, |
101 base::Bind(&ComponentUpdateService::MaybeThrottle, | 101 base::Bind(&ComponentUpdateService::MaybeThrottle, |
102 base::Unretained(cus), | 102 base::Unretained(cus), |
103 crx_id, | 103 crx_id, |
104 base::Bind(&UnblockThrottleOnUIThread, rt->AsWeakPtr()))); | 104 base::Bind(&UnblockThrottleOnUIThread, rt->AsWeakPtr()))); |
105 return rt; | 105 return rt; |
106 } | 106 } |
107 | 107 |
108 } // namespace component_updater | 108 } // namespace component_updater |
OLD | NEW |