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.h" | 5 #include "chrome/browser/extensions/api/tabs/tabs.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 if (!url.SchemeIs(chrome::kJavaScriptScheme)) | 1346 if (!url.SchemeIs(chrome::kJavaScriptScheme)) |
1347 DCHECK_EQ(url.spec(), tab_contents_->web_contents()->GetURL().spec()); | 1347 DCHECK_EQ(url.spec(), tab_contents_->web_contents()->GetURL().spec()); |
1348 | 1348 |
1349 return true; | 1349 return true; |
1350 } | 1350 } |
1351 | 1351 |
1352 void UpdateTabFunction::PopulateResult() { | 1352 void UpdateTabFunction::PopulateResult() { |
1353 if (!has_callback()) | 1353 if (!has_callback()) |
1354 return; | 1354 return; |
1355 | 1355 |
1356 if (GetExtension()->HasAPIPermission(ExtensionAPIPermission::kTab)) { | 1356 if (GetExtension()->HasAPIPermission(extensions::APIPermission::kTab)) { |
1357 result_.reset( | 1357 result_.reset( |
1358 ExtensionTabUtil::CreateTabValue(tab_contents_->web_contents())); | 1358 ExtensionTabUtil::CreateTabValue(tab_contents_->web_contents())); |
1359 } else { | 1359 } else { |
1360 result_.reset(Value::CreateNullValue()); | 1360 result_.reset(Value::CreateNullValue()); |
1361 } | 1361 } |
1362 } | 1362 } |
1363 | 1363 |
1364 void UpdateTabFunction::OnExecuteCodeFinished(bool success, | 1364 void UpdateTabFunction::OnExecuteCodeFinished(bool success, |
1365 int32 page_id, | 1365 int32 page_id, |
1366 const std::string& error, | 1366 const std::string& error, |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1826 // called for every API call the extension made. | 1826 // called for every API call the extension made. |
1827 GotLanguage(language); | 1827 GotLanguage(language); |
1828 } | 1828 } |
1829 | 1829 |
1830 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { | 1830 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
1831 result_.reset(Value::CreateStringValue(language.c_str())); | 1831 result_.reset(Value::CreateStringValue(language.c_str())); |
1832 SendResponse(true); | 1832 SendResponse(true); |
1833 | 1833 |
1834 Release(); // Balanced in Run() | 1834 Release(); // Balanced in Run() |
1835 } | 1835 } |
OLD | NEW |