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_api.h" | 5 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <limits> | 9 #include <limits> |
10 #include <utility> | 10 #include <utility> |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 panel->ShowInactive(); | 620 panel->ShowInactive(); |
621 else | 621 else |
622 panel->Show(); | 622 panel->Show(); |
623 | 623 |
624 SetResult(panel->extension_window_controller()->CreateWindowValueWithTabs( | 624 SetResult(panel->extension_window_controller()->CreateWindowValueWithTabs( |
625 extension())); | 625 extension())); |
626 return true; | 626 return true; |
627 } | 627 } |
628 | 628 |
629 // Create a new BrowserWindow. | 629 // Create a new BrowserWindow. |
630 chrome::HostDesktopType host_desktop_type = chrome::GetActiveDesktop(); | |
631 if (create_panel) | 630 if (create_panel) |
632 window_type = Browser::TYPE_POPUP; | 631 window_type = Browser::TYPE_POPUP; |
633 Browser::CreateParams create_params(window_type, window_profile, | 632 Browser::CreateParams create_params(window_type, window_profile); |
634 host_desktop_type); | |
635 if (extension_id.empty()) { | 633 if (extension_id.empty()) { |
636 create_params.initial_bounds = window_bounds; | 634 create_params.initial_bounds = window_bounds; |
637 } else { | 635 } else { |
638 create_params = Browser::CreateParams::CreateForApp( | 636 create_params = Browser::CreateParams::CreateForApp( |
639 web_app::GenerateApplicationNameFromExtensionId(extension_id), | 637 web_app::GenerateApplicationNameFromExtensionId(extension_id), |
640 false /* trusted_source */, | 638 false /* trusted_source */, window_bounds, window_profile); |
641 window_bounds, | |
642 window_profile, | |
643 host_desktop_type); | |
644 } | 639 } |
645 create_params.initial_show_state = ui::SHOW_STATE_NORMAL; | 640 create_params.initial_show_state = ui::SHOW_STATE_NORMAL; |
646 if (create_data && create_data->state) { | 641 if (create_data && create_data->state) { |
647 create_params.initial_show_state = | 642 create_params.initial_show_state = |
648 ConvertToWindowShowState(create_data->state); | 643 ConvertToWindowShowState(create_data->state); |
649 } | 644 } |
650 create_params.host_desktop_type = chrome::GetActiveDesktop(); | |
651 | 645 |
652 Browser* new_window = new Browser(create_params); | 646 Browser* new_window = new Browser(create_params); |
653 | 647 |
654 for (std::vector<GURL>::iterator i = urls.begin(); i != urls.end(); ++i) { | 648 for (std::vector<GURL>::iterator i = urls.begin(); i != urls.end(); ++i) { |
655 WebContents* tab = chrome::AddSelectedTabWithURL( | 649 WebContents* tab = chrome::AddSelectedTabWithURL( |
656 new_window, *i, ui::PAGE_TRANSITION_LINK); | 650 new_window, *i, ui::PAGE_TRANSITION_LINK); |
657 if (create_panel) { | 651 if (create_panel) { |
658 TabHelper::FromWebContents(tab)->SetExtensionAppIconById(extension_id); | 652 TabHelper::FromWebContents(tab)->SetExtensionAppIconById(extension_id); |
659 } | 653 } |
660 } | 654 } |
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2130 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); | 2124 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); |
2131 zoom_settings.default_zoom_factor.reset(new double( | 2125 zoom_settings.default_zoom_factor.reset(new double( |
2132 content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()))); | 2126 content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()))); |
2133 | 2127 |
2134 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); | 2128 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); |
2135 SendResponse(true); | 2129 SendResponse(true); |
2136 return true; | 2130 return true; |
2137 } | 2131 } |
2138 | 2132 |
2139 } // namespace extensions | 2133 } // namespace extensions |
OLD | NEW |