Chromium Code Reviews| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 #include "chrome/browser/ui/browser_window.h" | 43 #include "chrome/browser/ui/browser_window.h" |
| 44 #include "chrome/browser/ui/extensions/shell_window.h" | 44 #include "chrome/browser/ui/extensions/shell_window.h" |
| 45 #include "chrome/browser/ui/panels/panel_manager.h" | 45 #include "chrome/browser/ui/panels/panel_manager.h" |
| 46 #include "chrome/browser/ui/snapshot_tab_helper.h" | 46 #include "chrome/browser/ui/snapshot_tab_helper.h" |
| 47 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 47 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 48 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 48 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 49 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 49 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
| 50 #include "chrome/browser/web_applications/web_app.h" | 50 #include "chrome/browser/web_applications/web_app.h" |
| 51 #include "chrome/common/chrome_notification_types.h" | 51 #include "chrome/common/chrome_notification_types.h" |
| 52 #include "chrome/common/chrome_switches.h" | 52 #include "chrome/common/chrome_switches.h" |
| 53 #include "chrome/common/chrome_version_info.h" | |
| 53 #include "chrome/common/extensions/api/windows.h" | 54 #include "chrome/common/extensions/api/windows.h" |
| 54 #include "chrome/common/extensions/extension.h" | 55 #include "chrome/common/extensions/extension.h" |
| 55 #include "chrome/common/extensions/extension_error_utils.h" | 56 #include "chrome/common/extensions/extension_error_utils.h" |
| 56 #include "chrome/common/extensions/extension_manifest_constants.h" | 57 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 57 #include "chrome/common/extensions/extension_messages.h" | 58 #include "chrome/common/extensions/extension_messages.h" |
| 58 #include "chrome/common/extensions/user_script.h" | 59 #include "chrome/common/extensions/user_script.h" |
| 59 #include "chrome/common/pref_names.h" | 60 #include "chrome/common/pref_names.h" |
| 60 #include "chrome/common/url_constants.h" | 61 #include "chrome/common/url_constants.h" |
| 61 #include "content/public/browser/navigation_controller.h" | 62 #include "content/public/browser/navigation_controller.h" |
| 62 #include "content/public/browser/navigation_entry.h" | 63 #include "content/public/browser/navigation_entry.h" |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 568 error_ = keys::kInvalidWindowTypeError; | 569 error_ = keys::kInvalidWindowTypeError; |
| 569 return false; | 570 return false; |
| 570 } | 571 } |
| 571 } | 572 } |
| 572 } | 573 } |
| 573 | 574 |
| 574 if (window_type == Browser::TYPE_PANEL) { | 575 if (window_type == Browser::TYPE_PANEL) { |
| 575 std::string title = | 576 std::string title = |
| 576 web_app::GenerateApplicationNameFromExtensionId(extension_id); | 577 web_app::GenerateApplicationNameFromExtensionId(extension_id); |
| 577 #if !defined(USE_ASH) | 578 #if !defined(USE_ASH) |
| 579 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | |
| 578 if (CommandLine::ForCurrentProcess()->HasSwitch( | 580 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 579 switches::kBrowserlessPanels)) { | 581 switches::kBrowserlessPanels) || |
| 582 channel == chrome::VersionInfo::CHANNEL_DEV || | |
| 583 channel == chrome::VersionInfo::CHANNEL_CANARY) { | |
|
Matt Perry
2012/08/16 20:22:07
You can use channel <= DEV to cover these cases, a
jennb
2012/08/16 20:42:50
I don't want to include CHANNEL_UNKNOWN. That way,
| |
| 580 // Note: Panels ignore all but the first url provided. | 584 // Note: Panels ignore all but the first url provided. |
| 581 Panel* panel = PanelManager::GetInstance()->CreatePanel( | 585 Panel* panel = PanelManager::GetInstance()->CreatePanel( |
| 582 title, window_profile, urls[0], panel_bounds.size()); | 586 title, window_profile, urls[0], panel_bounds.size()); |
| 583 | 587 |
| 584 // Unlike other window types, Panels do not take focus by default. | 588 // Unlike other window types, Panels do not take focus by default. |
| 585 if (!saw_focus_key || !focused) | 589 if (!saw_focus_key || !focused) |
| 586 panel->ShowInactive(); | 590 panel->ShowInactive(); |
| 587 else | 591 else |
| 588 panel->Show(); | 592 panel->Show(); |
| 589 | 593 |
| (...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1820 // called for every API call the extension made. | 1824 // called for every API call the extension made. |
| 1821 GotLanguage(language); | 1825 GotLanguage(language); |
| 1822 } | 1826 } |
| 1823 | 1827 |
| 1824 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { | 1828 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
| 1825 SetResult(Value::CreateStringValue(language.c_str())); | 1829 SetResult(Value::CreateStringValue(language.c_str())); |
| 1826 SendResponse(true); | 1830 SendResponse(true); |
| 1827 | 1831 |
| 1828 Release(); // Balanced in Run() | 1832 Release(); // Balanced in Run() |
| 1829 } | 1833 } |
| OLD | NEW |