| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "chrome/browser/ui/browser_window.h" | 44 #include "chrome/browser/ui/browser_window.h" |
| 45 #include "chrome/browser/ui/extensions/shell_window.h" | 45 #include "chrome/browser/ui/extensions/shell_window.h" |
| 46 #include "chrome/browser/ui/host_desktop.h" | 46 #include "chrome/browser/ui/host_desktop.h" |
| 47 #include "chrome/browser/ui/panels/panel_manager.h" | 47 #include "chrome/browser/ui/panels/panel_manager.h" |
| 48 #include "chrome/browser/ui/snapshot_tab_helper.h" | 48 #include "chrome/browser/ui/snapshot_tab_helper.h" |
| 49 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 49 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 50 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 50 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
| 51 #include "chrome/browser/web_applications/web_app.h" | 51 #include "chrome/browser/web_applications/web_app.h" |
| 52 #include "chrome/common/chrome_notification_types.h" | 52 #include "chrome/common/chrome_notification_types.h" |
| 53 #include "chrome/common/chrome_switches.h" | 53 #include "chrome/common/chrome_switches.h" |
| 54 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" |
| 54 #include "chrome/common/extensions/api/tabs.h" | 55 #include "chrome/common/extensions/api/tabs.h" |
| 55 #include "chrome/common/extensions/api/windows.h" | 56 #include "chrome/common/extensions/api/windows.h" |
| 56 #include "chrome/common/extensions/extension.h" | 57 #include "chrome/common/extensions/extension.h" |
| 57 #include "chrome/common/extensions/extension_constants.h" | 58 #include "chrome/common/extensions/extension_constants.h" |
| 58 #include "chrome/common/extensions/extension_file_util.h" | 59 #include "chrome/common/extensions/extension_file_util.h" |
| 59 #include "chrome/common/extensions/extension_l10n_util.h" | 60 #include "chrome/common/extensions/extension_l10n_util.h" |
| 60 #include "chrome/common/extensions/extension_manifest_constants.h" | 61 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 61 #include "chrome/common/extensions/extension_messages.h" | 62 #include "chrome/common/extensions/extension_messages.h" |
| 62 #include "chrome/common/extensions/message_bundle.h" | 63 #include "chrome/common/extensions/message_bundle.h" |
| 63 #include "chrome/common/extensions/user_script.h" | 64 #include "chrome/common/extensions/user_script.h" |
| (...skipping 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2025 function_name == TabsInsertCSSFunction::function_name() && | 2026 function_name == TabsInsertCSSFunction::function_name() && |
| 2026 extension != NULL && | 2027 extension != NULL && |
| 2027 data.find( | 2028 data.find( |
| 2028 extensions::MessageBundle::kMessageBegin) != std::string::npos) { | 2029 extensions::MessageBundle::kMessageBegin) != std::string::npos) { |
| 2029 BrowserThread::PostTask( | 2030 BrowserThread::PostTask( |
| 2030 BrowserThread::FILE, FROM_HERE, | 2031 BrowserThread::FILE, FROM_HERE, |
| 2031 base::Bind(&ExecuteCodeInTabFunction::LocalizeCSS, this, | 2032 base::Bind(&ExecuteCodeInTabFunction::LocalizeCSS, this, |
| 2032 data, | 2033 data, |
| 2033 extension->id(), | 2034 extension->id(), |
| 2034 extension->path(), | 2035 extension->path(), |
| 2035 extension->default_locale())); | 2036 extensions::LocaleInfo::GetDefaultLocale(extension))); |
| 2036 } else { | 2037 } else { |
| 2037 DidLoadAndLocalizeFile(success, data); | 2038 DidLoadAndLocalizeFile(success, data); |
| 2038 } | 2039 } |
| 2039 } | 2040 } |
| 2040 | 2041 |
| 2041 void ExecuteCodeInTabFunction::LocalizeCSS( | 2042 void ExecuteCodeInTabFunction::LocalizeCSS( |
| 2042 const std::string& data, | 2043 const std::string& data, |
| 2043 const std::string& extension_id, | 2044 const std::string& extension_id, |
| 2044 const FilePath& extension_path, | 2045 const FilePath& extension_path, |
| 2045 const std::string& extension_default_locale) { | 2046 const std::string& extension_default_locale) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2129 extension->id(), | 2130 extension->id(), |
| 2130 script_type, | 2131 script_type, |
| 2131 code_string, | 2132 code_string, |
| 2132 frame_scope, | 2133 frame_scope, |
| 2133 run_at, | 2134 run_at, |
| 2134 ScriptExecutor::ISOLATED_WORLD, | 2135 ScriptExecutor::ISOLATED_WORLD, |
| 2135 false /* is_web_view */, | 2136 false /* is_web_view */, |
| 2136 base::Bind(&ExecuteCodeInTabFunction::OnExecuteCodeFinished, this)); | 2137 base::Bind(&ExecuteCodeInTabFunction::OnExecuteCodeFinished, this)); |
| 2137 return true; | 2138 return true; |
| 2138 } | 2139 } |
| OLD | NEW |