| 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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 } | 570 } |
| 571 | 571 |
| 572 if (args->HasKey(keys::kFocusedKey)) { | 572 if (args->HasKey(keys::kFocusedKey)) { |
| 573 EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kFocusedKey, | 573 EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kFocusedKey, |
| 574 &focused)); | 574 &focused)); |
| 575 saw_focus_key = true; | 575 saw_focus_key = true; |
| 576 } | 576 } |
| 577 } | 577 } |
| 578 | 578 |
| 579 #if !defined(USE_ASH) | 579 #if !defined(USE_ASH) |
| 580 if (window_type == Browser::TYPE_PANEL && | 580 if (window_type == Browser::TYPE_PANEL) { |
| 581 PanelManager::UseBrowserlessPanels()) { | |
| 582 std::string title = | 581 std::string title = |
| 583 web_app::GenerateApplicationNameFromExtensionId(extension_id); | 582 web_app::GenerateApplicationNameFromExtensionId(extension_id); |
| 584 // Note: Panels ignore all but the first url provided. | 583 // Note: Panels ignore all but the first url provided. |
| 585 Panel* panel = PanelManager::GetInstance()->CreatePanel( | 584 Panel* panel = PanelManager::GetInstance()->CreatePanel( |
| 586 title, window_profile, urls[0], window_bounds, panel_create_mode); | 585 title, window_profile, urls[0], window_bounds, panel_create_mode); |
| 587 | 586 |
| 588 // Unlike other window types, Panels do not take focus by default. | 587 // Unlike other window types, Panels do not take focus by default. |
| 589 if (!saw_focus_key || !focused) | 588 if (!saw_focus_key || !focused) |
| 590 panel->ShowInactive(); | 589 panel->ShowInactive(); |
| 591 else | 590 else |
| 592 panel->Show(); | 591 panel->Show(); |
| 593 | 592 |
| 594 SetResult( | 593 SetResult( |
| 595 panel->extension_window_controller()->CreateWindowValueWithTabs( | 594 panel->extension_window_controller()->CreateWindowValueWithTabs( |
| 596 GetExtension())); | 595 GetExtension())); |
| 597 return true; | 596 return true; |
| 598 } | 597 } |
| 599 // else fall through to create BrowserWindow | |
| 600 #endif | 598 #endif |
| 601 | 599 |
| 602 // Create a new BrowserWindow. | 600 // Create a new BrowserWindow. |
| 603 Browser::CreateParams create_params(window_type, window_profile); | 601 Browser::CreateParams create_params(window_type, window_profile); |
| 604 if (extension_id.empty()) { | 602 if (extension_id.empty()) { |
| 605 create_params.initial_bounds = window_bounds; | 603 create_params.initial_bounds = window_bounds; |
| 606 } else { | 604 } else { |
| 607 create_params = Browser::CreateParams::CreateForApp( | 605 create_params = Browser::CreateParams::CreateForApp( |
| 608 window_type, | 606 window_type, |
| 609 web_app::GenerateApplicationNameFromExtensionId(extension_id), | 607 web_app::GenerateApplicationNameFromExtensionId(extension_id), |
| (...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1863 // called for every API call the extension made. | 1861 // called for every API call the extension made. |
| 1864 GotLanguage(language); | 1862 GotLanguage(language); |
| 1865 } | 1863 } |
| 1866 | 1864 |
| 1867 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { | 1865 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
| 1868 SetResult(Value::CreateStringValue(language.c_str())); | 1866 SetResult(Value::CreateStringValue(language.c_str())); |
| 1869 SendResponse(true); | 1867 SendResponse(true); |
| 1870 | 1868 |
| 1871 Release(); // Balanced in Run() | 1869 Release(); // Balanced in Run() |
| 1872 } | 1870 } |
| OLD | NEW |