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/api/tabs/tabs_api.h" | 5 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 2082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2093 if (!Execute(data)) | 2093 if (!Execute(data)) |
2094 SendResponse(false); | 2094 SendResponse(false); |
2095 } else { | 2095 } else { |
2096 #if defined(OS_POSIX) | 2096 #if defined(OS_POSIX) |
2097 // TODO(viettrungluu): bug: there's no particular reason the path should be | 2097 // TODO(viettrungluu): bug: there's no particular reason the path should be |
2098 // UTF-8, in which case this may fail. | 2098 // UTF-8, in which case this may fail. |
2099 error_ = ErrorUtils::FormatErrorMessage(keys::kLoadFileError, | 2099 error_ = ErrorUtils::FormatErrorMessage(keys::kLoadFileError, |
2100 resource_.relative_path().value()); | 2100 resource_.relative_path().value()); |
2101 #elif defined(OS_WIN) | 2101 #elif defined(OS_WIN) |
2102 error_ = ErrorUtils::FormatErrorMessage(keys::kLoadFileError, | 2102 error_ = ErrorUtils::FormatErrorMessage(keys::kLoadFileError, |
2103 WideToUTF8(resource_.relative_path().value())); | 2103 base::WideToUTF8(resource_.relative_path().value())); |
2104 #endif // OS_WIN | 2104 #endif // OS_WIN |
2105 SendResponse(false); | 2105 SendResponse(false); |
2106 } | 2106 } |
2107 } | 2107 } |
2108 | 2108 |
2109 bool ExecuteCodeInTabFunction::Execute(const std::string& code_string) { | 2109 bool ExecuteCodeInTabFunction::Execute(const std::string& code_string) { |
2110 content::WebContents* contents = NULL; | 2110 content::WebContents* contents = NULL; |
2111 Browser* browser = NULL; | 2111 Browser* browser = NULL; |
2112 | 2112 |
2113 bool success = ExtensionTabUtil::GetTabById( | 2113 bool success = ExtensionTabUtil::GetTabById( |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2154 extension->id(), | 2154 extension->id(), |
2155 script_type, | 2155 script_type, |
2156 code_string, | 2156 code_string, |
2157 frame_scope, | 2157 frame_scope, |
2158 run_at, | 2158 run_at, |
2159 ScriptExecutor::ISOLATED_WORLD, | 2159 ScriptExecutor::ISOLATED_WORLD, |
2160 false /* is_web_view */, | 2160 false /* is_web_view */, |
2161 base::Bind(&ExecuteCodeInTabFunction::OnExecuteCodeFinished, this)); | 2161 base::Bind(&ExecuteCodeInTabFunction::OnExecuteCodeFinished, this)); |
2162 return true; | 2162 return true; |
2163 } | 2163 } |
OLD | NEW |