| 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 "extensions/renderer/programmatic_script_injector.h" | 5 #include "extensions/renderer/programmatic_script_injector.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "content/public/common/url_constants.h" | 10 #include "content/public/common/url_constants.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 InjectFailureReason reason, | 126 InjectFailureReason reason, |
| 127 content::RenderFrame* render_frame) { | 127 content::RenderFrame* render_frame) { |
| 128 std::string error; | 128 std::string error; |
| 129 switch (reason) { | 129 switch (reason) { |
| 130 case NOT_ALLOWED: | 130 case NOT_ALLOWED: |
| 131 if (url_.SchemeIs(url::kAboutScheme)) { | 131 if (url_.SchemeIs(url::kAboutScheme)) { |
| 132 error = ErrorUtils::FormatErrorMessage( | 132 error = ErrorUtils::FormatErrorMessage( |
| 133 manifest_errors::kCannotAccessAboutUrl, url_.spec(), | 133 manifest_errors::kCannotAccessAboutUrl, url_.spec(), |
| 134 effective_url_.GetOrigin().spec()); | 134 effective_url_.GetOrigin().spec()); |
| 135 } else { | 135 } else { |
| 136 error = ErrorUtils::FormatErrorMessage( | 136 error = manifest_errors::kCannotAccessPage; |
| 137 manifest_errors::kCannotAccessPage, url_.spec()); | |
| 138 } | 137 } |
| 139 break; | 138 break; |
| 140 case EXTENSION_REMOVED: // no special error here. | 139 case EXTENSION_REMOVED: // no special error here. |
| 141 case WONT_INJECT: | 140 case WONT_INJECT: |
| 142 break; | 141 break; |
| 143 } | 142 } |
| 144 Finish(error, render_frame); | 143 Finish(error, render_frame); |
| 145 } | 144 } |
| 146 | 145 |
| 147 UserScript::RunLocation ProgrammaticScriptInjector::GetRunLocation() const { | 146 UserScript::RunLocation ProgrammaticScriptInjector::GetRunLocation() const { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 158 // frame deletions so nothing is left hanging). | 157 // frame deletions so nothing is left hanging). |
| 159 if (render_frame) { | 158 if (render_frame) { |
| 160 render_frame->Send( | 159 render_frame->Send( |
| 161 new ExtensionHostMsg_ExecuteCodeFinished( | 160 new ExtensionHostMsg_ExecuteCodeFinished( |
| 162 render_frame->GetRoutingID(), params_->request_id, | 161 render_frame->GetRoutingID(), params_->request_id, |
| 163 error, url_, results_)); | 162 error, url_, results_)); |
| 164 } | 163 } |
| 165 } | 164 } |
| 166 | 165 |
| 167 } // namespace extensions | 166 } // namespace extensions |
| OLD | NEW |