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/extension_tabs_module.h" | 5 #include "chrome/browser/extensions/extension_tabs_module.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 ExtensionMsg_ExecuteCode_Params params; | 1175 ExtensionMsg_ExecuteCode_Params params; |
1176 params.request_id = request_id(); | 1176 params.request_id = request_id(); |
1177 params.extension_id = extension_id(); | 1177 params.extension_id = extension_id(); |
1178 params.is_javascript = true; | 1178 params.is_javascript = true; |
1179 params.code = url.path(); | 1179 params.code = url.path(); |
1180 params.all_frames = false; | 1180 params.all_frames = false; |
1181 params.in_main_world = true; | 1181 params.in_main_world = true; |
1182 | 1182 |
1183 RenderViewHost* render_view_host = web_contents_->GetRenderViewHost(); | 1183 RenderViewHost* render_view_host = web_contents_->GetRenderViewHost(); |
1184 render_view_host->Send( | 1184 render_view_host->Send( |
1185 new ExtensionMsg_ExecuteCode(render_view_host->routing_id(), | 1185 new ExtensionMsg_ExecuteCode(render_view_host->GetRoutingID(), |
1186 params)); | 1186 params)); |
1187 | 1187 |
1188 Observe(web_contents_); | 1188 Observe(web_contents_); |
1189 AddRef(); // Balanced in OnExecuteCodeFinished(). | 1189 AddRef(); // Balanced in OnExecuteCodeFinished(). |
1190 | 1190 |
1191 is_async = true; | 1191 is_async = true; |
1192 } | 1192 } |
1193 | 1193 |
1194 controller.LoadURL( | 1194 controller.LoadURL( |
1195 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); | 1195 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 error_ = keys::kTabStripNotEditableError; | 1502 error_ = keys::kTabStripNotEditableError; |
1503 return false; | 1503 return false; |
1504 } | 1504 } |
1505 | 1505 |
1506 // Close the tab in this convoluted way, since there's a chance that the tab | 1506 // Close the tab in this convoluted way, since there's a chance that the tab |
1507 // is being dragged, or we're in some other nested event loop. This code | 1507 // is being dragged, or we're in some other nested event loop. This code |
1508 // path should ensure that the tab is safely closed under such | 1508 // path should ensure that the tab is safely closed under such |
1509 // circumstances, whereas |Browser::CloseTabContents()| does not. | 1509 // circumstances, whereas |Browser::CloseTabContents()| does not. |
1510 RenderViewHost* render_view_host = | 1510 RenderViewHost* render_view_host = |
1511 contents->web_contents()->GetRenderViewHost(); | 1511 contents->web_contents()->GetRenderViewHost(); |
1512 render_view_host->delegate()->Close(render_view_host); | 1512 render_view_host->GetDelegate()->Close(render_view_host); |
1513 } | 1513 } |
1514 return true; | 1514 return true; |
1515 } | 1515 } |
1516 | 1516 |
1517 bool CaptureVisibleTabFunction::RunImpl() { | 1517 bool CaptureVisibleTabFunction::RunImpl() { |
1518 Browser* browser = NULL; | 1518 Browser* browser = NULL; |
1519 // windowId defaults to "current" window. | 1519 // windowId defaults to "current" window. |
1520 int window_id = extension_misc::kCurrentWindowId; | 1520 int window_id = extension_misc::kCurrentWindowId; |
1521 | 1521 |
1522 if (HasOptionalArgument(0)) | 1522 if (HasOptionalArgument(0)) |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 // called for every API call the extension made. | 1745 // called for every API call the extension made. |
1746 GotLanguage(language); | 1746 GotLanguage(language); |
1747 } | 1747 } |
1748 | 1748 |
1749 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { | 1749 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
1750 result_.reset(Value::CreateStringValue(language.c_str())); | 1750 result_.reset(Value::CreateStringValue(language.c_str())); |
1751 SendResponse(true); | 1751 SendResponse(true); |
1752 | 1752 |
1753 Release(); // Balanced in Run() | 1753 Release(); // Balanced in Run() |
1754 } | 1754 } |
OLD | NEW |