| 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 "extensions/browser/api/web_request/web_request_api.h" | 5 #include "extensions/browser/api/web_request/web_request_api.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 NOTREACHED(); | 130 NOTREACHED(); |
| 131 return "Not reached"; | 131 return "Not reached"; |
| 132 } | 132 } |
| 133 | 133 |
| 134 int GetFrameId(bool is_main_frame, int frame_id) { | 134 int GetFrameId(bool is_main_frame, int frame_id) { |
| 135 return is_main_frame ? 0 : frame_id; | 135 return is_main_frame ? 0 : frame_id; |
| 136 } | 136 } |
| 137 | 137 |
| 138 bool IsWebRequestEvent(const std::string& event_name) { | 138 bool IsWebRequestEvent(const std::string& event_name) { |
| 139 std::string web_request_event_name(event_name); | 139 std::string web_request_event_name(event_name); |
| 140 if (base::StartsWithASCII(web_request_event_name, | 140 if (base::StartsWith(web_request_event_name, |
| 141 webview::kWebViewEventPrefix, true)) { | 141 webview::kWebViewEventPrefix, |
| 142 base::CompareCase::SENSITIVE)) { |
| 142 web_request_event_name.replace( | 143 web_request_event_name.replace( |
| 143 0, strlen(webview::kWebViewEventPrefix), kWebRequestEventPrefix); | 144 0, strlen(webview::kWebViewEventPrefix), kWebRequestEventPrefix); |
| 144 } | 145 } |
| 145 return std::find( | 146 return std::find( |
| 146 kWebRequestEvents, | 147 kWebRequestEvents, |
| 147 kWebRequestEvents + kWebRequestEventsLength, | 148 kWebRequestEvents + kWebRequestEventsLength, |
| 148 web_request_event_name) != (kWebRequestEvents + kWebRequestEventsLength); | 149 web_request_event_name) != (kWebRequestEvents + kWebRequestEventsLength); |
| 149 } | 150 } |
| 150 | 151 |
| 151 // Returns whether |request| has been triggered by an extension in | 152 // Returns whether |request| has been triggered by an extension in |
| (...skipping 2305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2457 base::Bind(&WarningService::NotifyWarningsOnUI, profile_id(), warnings)); | 2458 base::Bind(&WarningService::NotifyWarningsOnUI, profile_id(), warnings)); |
| 2458 | 2459 |
| 2459 // Continue gracefully. | 2460 // Continue gracefully. |
| 2460 RunSync(); | 2461 RunSync(); |
| 2461 } | 2462 } |
| 2462 | 2463 |
| 2463 bool WebRequestHandlerBehaviorChangedFunction::RunSync() { | 2464 bool WebRequestHandlerBehaviorChangedFunction::RunSync() { |
| 2464 helpers::ClearCacheOnNavigation(); | 2465 helpers::ClearCacheOnNavigation(); |
| 2465 return true; | 2466 return true; |
| 2466 } | 2467 } |
| OLD | NEW |