| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 QueryArg pinned = ParseBoolQueryArg(query, keys::kPinnedKey); | 720 QueryArg pinned = ParseBoolQueryArg(query, keys::kPinnedKey); |
| 721 QueryArg selected = ParseBoolQueryArg(query, keys::kHighlightedKey); | 721 QueryArg selected = ParseBoolQueryArg(query, keys::kHighlightedKey); |
| 722 | 722 |
| 723 QueryArg loading = NOT_SET; | 723 QueryArg loading = NOT_SET; |
| 724 if (query->HasKey(keys::kStatusKey)) { | 724 if (query->HasKey(keys::kStatusKey)) { |
| 725 std::string status; | 725 std::string status; |
| 726 EXTENSION_FUNCTION_VALIDATE(query->GetString(keys::kStatusKey, &status)); | 726 EXTENSION_FUNCTION_VALIDATE(query->GetString(keys::kStatusKey, &status)); |
| 727 loading = (status == keys::kStatusValueLoading) ? MATCH_TRUE : MATCH_FALSE; | 727 loading = (status == keys::kStatusValueLoading) ? MATCH_TRUE : MATCH_FALSE; |
| 728 } | 728 } |
| 729 | 729 |
| 730 // It is o.k. to use URLPattern::SCHEME_ALL here because this function does |
| 731 // not grant access to the content of the tabs, only to seeing their URLs and |
| 732 // meta data. |
| 730 URLPattern url_pattern(URLPattern::SCHEME_ALL, "<all_urls>"); | 733 URLPattern url_pattern(URLPattern::SCHEME_ALL, "<all_urls>"); |
| 731 if (query->HasKey(keys::kUrlKey)) { | 734 if (query->HasKey(keys::kUrlKey)) { |
| 732 std::string value; | 735 std::string value; |
| 733 EXTENSION_FUNCTION_VALIDATE(query->GetString(keys::kUrlKey, &value)); | 736 EXTENSION_FUNCTION_VALIDATE(query->GetString(keys::kUrlKey, &value)); |
| 734 url_pattern = URLPattern(URLPattern::SCHEME_ALL, value); | 737 url_pattern = URLPattern(URLPattern::SCHEME_ALL, value); |
| 735 } | 738 } |
| 736 | 739 |
| 737 std::string title; | 740 std::string title; |
| 738 if (query->HasKey(keys::kTitleKey)) | 741 if (query->HasKey(keys::kTitleKey)) |
| 739 EXTENSION_FUNCTION_VALIDATE( | 742 EXTENSION_FUNCTION_VALIDATE( |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1615 // called for every API call the extension made. | 1618 // called for every API call the extension made. |
| 1616 GotLanguage(language); | 1619 GotLanguage(language); |
| 1617 } | 1620 } |
| 1618 | 1621 |
| 1619 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { | 1622 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
| 1620 result_.reset(Value::CreateStringValue(language.c_str())); | 1623 result_.reset(Value::CreateStringValue(language.c_str())); |
| 1621 SendResponse(true); | 1624 SendResponse(true); |
| 1622 | 1625 |
| 1623 Release(); // Balanced in Run() | 1626 Release(); // Balanced in Run() |
| 1624 } | 1627 } |
| OLD | NEW |