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 #include "chrome/browser/extensions/user_script_listener.h" | 5 #include "chrome/browser/extensions/user_script_listener.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" | 10 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 void Resume() { | 33 void Resume() { |
34 DCHECK(should_defer_); | 34 DCHECK(should_defer_); |
35 should_defer_ = false; | 35 should_defer_ = false; |
36 // Only resume the request if |this| has deferred it. | 36 // Only resume the request if |this| has deferred it. |
37 if (did_defer_) | 37 if (did_defer_) |
38 controller()->Resume(); | 38 controller()->Resume(); |
39 } | 39 } |
40 | 40 |
41 // ResourceThrottle implementation: | 41 // ResourceThrottle implementation: |
42 virtual void WillStartRequest(bool* defer) OVERRIDE { | 42 virtual void WillStartRequest(bool* defer) override { |
43 // Only defer requests if Resume has not yet been called. | 43 // Only defer requests if Resume has not yet been called. |
44 if (should_defer_) { | 44 if (should_defer_) { |
45 *defer = true; | 45 *defer = true; |
46 did_defer_ = true; | 46 did_defer_ = true; |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 virtual const char* GetNameForLogging() const OVERRIDE { | 50 virtual const char* GetNameForLogging() const override { |
51 return "UserScriptListener::Throttle"; | 51 return "UserScriptListener::Throttle"; |
52 } | 52 } |
53 | 53 |
54 private: | 54 private: |
55 bool should_defer_; | 55 bool should_defer_; |
56 bool did_defer_; | 56 bool did_defer_; |
57 }; | 57 }; |
58 | 58 |
59 struct UserScriptListener::ProfileData { | 59 struct UserScriptListener::ProfileData { |
60 // True if the user scripts contained in |url_patterns| are ready for | 60 // True if the user scripts contained in |url_patterns| are ready for |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 &UserScriptListener::ProfileDestroyed, this, profile)); | 262 &UserScriptListener::ProfileDestroyed, this, profile)); |
263 break; | 263 break; |
264 } | 264 } |
265 | 265 |
266 default: | 266 default: |
267 NOTREACHED(); | 267 NOTREACHED(); |
268 } | 268 } |
269 } | 269 } |
270 | 270 |
271 } // namespace extensions | 271 } // namespace extensions |
OLD | NEW |