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 <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 567 matching lines...) Loading... |
578 return true; | 578 return true; |
579 } | 579 } |
580 #endif | 580 #endif |
581 std::string title = | 581 std::string title = |
582 web_app::GenerateApplicationNameFromExtensionId(extension_id); | 582 web_app::GenerateApplicationNameFromExtensionId(extension_id); |
583 // Note: Panels ignore all but the first url provided. | 583 // Note: Panels ignore all but the first url provided. |
584 Panel* panel = PanelManager::GetInstance()->CreatePanel( | 584 Panel* panel = PanelManager::GetInstance()->CreatePanel( |
585 title, window_profile, urls[0], window_bounds, panel_create_mode); | 585 title, window_profile, urls[0], window_bounds, panel_create_mode); |
586 | 586 |
587 // Unlike other window types, Panels do not take focus by default. | 587 // Unlike other window types, Panels do not take focus by default. |
588 if (!saw_focus_key || !focused) | 588 if (!saw_focus_key || !focused) { |
589 panel->ShowInactive(); | 589 panel->ShowInactive(); |
590 else | 590 } else { |
591 panel->Show(); | 591 panel->Show(user_gesture()); |
| 592 } |
592 | 593 |
593 SetResult(panel->extension_window_controller()->CreateWindowValueWithTabs( | 594 SetResult(panel->extension_window_controller()->CreateWindowValueWithTabs( |
594 extension())); | 595 extension())); |
595 return true; | 596 return true; |
596 } | 597 } |
597 | 598 |
598 // Create a new BrowserWindow. | 599 // Create a new BrowserWindow. |
599 chrome::HostDesktopType host_desktop_type = chrome::GetActiveDesktop(); | 600 chrome::HostDesktopType host_desktop_type = chrome::GetActiveDesktop(); |
600 if (create_panel) | 601 if (create_panel) |
601 window_type = Browser::TYPE_POPUP; | 602 window_type = Browser::TYPE_POPUP; |
(...skipping 43 matching lines...) Loading... |
645 // tab when it is intended to create an empty popup. | 646 // tab when it is intended to create an empty popup. |
646 if (!contents && urls.empty() && window_type != Browser::TYPE_POPUP) { | 647 if (!contents && urls.empty() && window_type != Browser::TYPE_POPUP) { |
647 chrome::NewTab(new_window); | 648 chrome::NewTab(new_window); |
648 } | 649 } |
649 chrome::SelectNumberedTab(new_window, 0); | 650 chrome::SelectNumberedTab(new_window, 0); |
650 | 651 |
651 // Unlike other window types, Panels do not take focus by default. | 652 // Unlike other window types, Panels do not take focus by default. |
652 if (!saw_focus_key && create_panel) | 653 if (!saw_focus_key && create_panel) |
653 focused = false; | 654 focused = false; |
654 | 655 |
655 if (focused) | 656 if (focused) { |
656 new_window->window()->Show(); | 657 new_window->window()->Show(user_gesture()); |
657 else | 658 } else { |
658 new_window->window()->ShowInactive(); | 659 new_window->window()->ShowInactive(); |
| 660 } |
659 | 661 |
660 WindowController* controller = new_window->extension_window_controller(); | 662 WindowController* controller = new_window->extension_window_controller(); |
661 | 663 |
662 #if defined(OS_LINUX) || defined(OS_CHROMEOS) | 664 #if defined(OS_LINUX) || defined(OS_CHROMEOS) |
663 // On Desktop Linux, window managers may ignore hints until the X11 window is | 665 // On Desktop Linux, window managers may ignore hints until the X11 window is |
664 // mapped, which happens in the blocking call to Show() above. | 666 // mapped, which happens in the blocking call to Show() above. |
665 // DesktopWindowTreeHostX11 currently only checks for an attempt to maximize | 667 // DesktopWindowTreeHostX11 currently only checks for an attempt to maximize |
666 // once mapped, but not minimize or fullscreen. | 668 // once mapped, but not minimize or fullscreen. |
667 // For ChromeOS, manually Minimize(). Because minimzied window is not | 669 // For ChromeOS, manually Minimize(). Because minimzied window is not |
668 // considered to create new window. See http://crbug.com/473228. | 670 // considered to create new window. See http://crbug.com/473228. |
(...skipping 1336 matching lines...) Loading... |
2005 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); | 2007 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); |
2006 zoom_settings.default_zoom_factor.reset(new double( | 2008 zoom_settings.default_zoom_factor.reset(new double( |
2007 content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()))); | 2009 content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()))); |
2008 | 2010 |
2009 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); | 2011 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); |
2010 SendResponse(true); | 2012 SendResponse(true); |
2011 return true; | 2013 return true; |
2012 } | 2014 } |
2013 | 2015 |
2014 } // namespace extensions | 2016 } // namespace extensions |
OLD | NEW |