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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 std::string type_str; | 550 std::string type_str; |
551 if (args->HasKey(keys::kWindowTypeKey)) { | 551 if (args->HasKey(keys::kWindowTypeKey)) { |
552 EXTENSION_FUNCTION_VALIDATE(args->GetString(keys::kWindowTypeKey, | 552 EXTENSION_FUNCTION_VALIDATE(args->GetString(keys::kWindowTypeKey, |
553 &type_str)); | 553 &type_str)); |
554 if (type_str == keys::kWindowTypeValuePopup) { | 554 if (type_str == keys::kWindowTypeValuePopup) { |
555 window_type = Browser::TYPE_POPUP; | 555 window_type = Browser::TYPE_POPUP; |
556 extension_id = GetExtension()->id(); | 556 extension_id = GetExtension()->id(); |
557 } else if (type_str == keys::kWindowTypeValuePanel) { | 557 } else if (type_str == keys::kWindowTypeValuePanel) { |
558 extension_id = GetExtension()->id(); | 558 extension_id = GetExtension()->id(); |
559 bool use_panels = false; | 559 bool use_panels = false; |
560 #if !defined(OS_ANDROID) && !defined(USE_ASH) | 560 #if !defined(OS_ANDROID) |
561 use_panels = PanelManager::ShouldUsePanels(extension_id); | 561 use_panels = PanelManager::ShouldUsePanels(extension_id); |
562 #endif | 562 #endif |
563 if (use_panels) | 563 if (use_panels) |
564 window_type = Browser::TYPE_PANEL; | 564 window_type = Browser::TYPE_PANEL; |
565 else | 565 else |
566 window_type = Browser::TYPE_POPUP; | 566 window_type = Browser::TYPE_POPUP; |
567 } else if (type_str != keys::kWindowTypeValueNormal) { | 567 } else if (type_str != keys::kWindowTypeValueNormal) { |
568 error_ = keys::kInvalidWindowTypeError; | 568 error_ = keys::kInvalidWindowTypeError; |
569 return false; | 569 return false; |
570 } | 570 } |
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 // called for every API call the extension made. | 1819 // called for every API call the extension made. |
1820 GotLanguage(language); | 1820 GotLanguage(language); |
1821 } | 1821 } |
1822 | 1822 |
1823 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { | 1823 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
1824 SetResult(Value::CreateStringValue(language.c_str())); | 1824 SetResult(Value::CreateStringValue(language.c_str())); |
1825 SendResponse(true); | 1825 SendResponse(true); |
1826 | 1826 |
1827 Release(); // Balanced in Run() | 1827 Release(); // Balanced in Run() |
1828 } | 1828 } |
OLD | NEW |