| 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 // TODO(?) It would be nice to show kCannotAccessPageWithUrl here if |
| 137 manifest_errors::kCannotAccessPage, url_.spec()); | 137 // this is triggered by an extension with tabs permission. See |
| 138 // https://codereview.chromium.org/1414223005/diff/1/extensions/ |
| 139 // common/manifest_constants.cc#newcode269 |
| 140 error = manifest_errors::kCannotAccessPage; |
| 138 } | 141 } |
| 139 break; | 142 break; |
| 140 case EXTENSION_REMOVED: // no special error here. | 143 case EXTENSION_REMOVED: // no special error here. |
| 141 case WONT_INJECT: | 144 case WONT_INJECT: |
| 142 break; | 145 break; |
| 143 } | 146 } |
| 144 Finish(error, render_frame); | 147 Finish(error, render_frame); |
| 145 } | 148 } |
| 146 | 149 |
| 147 UserScript::RunLocation ProgrammaticScriptInjector::GetRunLocation() const { | 150 UserScript::RunLocation ProgrammaticScriptInjector::GetRunLocation() const { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 158 // frame deletions so nothing is left hanging). | 161 // frame deletions so nothing is left hanging). |
| 159 if (render_frame) { | 162 if (render_frame) { |
| 160 render_frame->Send( | 163 render_frame->Send( |
| 161 new ExtensionHostMsg_ExecuteCodeFinished( | 164 new ExtensionHostMsg_ExecuteCodeFinished( |
| 162 render_frame->GetRoutingID(), params_->request_id, | 165 render_frame->GetRoutingID(), params_->request_id, |
| 163 error, url_, results_)); | 166 error, url_, results_)); |
| 164 } | 167 } |
| 165 } | 168 } |
| 166 | 169 |
| 167 } // namespace extensions | 170 } // namespace extensions |
| OLD | NEW |