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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/ref_counted_memory.h" | 14 #include "base/memory/ref_counted_memory.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "chrome/browser/apps/scoped_keep_alive.h" |
22 #include "chrome/browser/chrome_notification_types.h" | 23 #include "chrome/browser/chrome_notification_types.h" |
23 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 24 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
24 #include "chrome/browser/extensions/api/tabs/windows_util.h" | 25 #include "chrome/browser/extensions/api/tabs/windows_util.h" |
25 #include "chrome/browser/extensions/extension_service.h" | 26 #include "chrome/browser/extensions/extension_service.h" |
26 #include "chrome/browser/extensions/extension_tab_util.h" | 27 #include "chrome/browser/extensions/extension_tab_util.h" |
27 #include "chrome/browser/extensions/tab_helper.h" | 28 #include "chrome/browser/extensions/tab_helper.h" |
28 #include "chrome/browser/extensions/window_controller.h" | 29 #include "chrome/browser/extensions/window_controller.h" |
29 #include "chrome/browser/extensions/window_controller_list.h" | 30 #include "chrome/browser/extensions/window_controller_list.h" |
30 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 31 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
31 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 if (create_panel) { | 504 if (create_panel) { |
504 if (urls.empty()) | 505 if (urls.empty()) |
505 urls.push_back(GURL(chrome::kChromeUINewTabURL)); | 506 urls.push_back(GURL(chrome::kChromeUINewTabURL)); |
506 | 507 |
507 #if defined(USE_ASH) | 508 #if defined(USE_ASH) |
508 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) { | 509 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) { |
509 AppWindow::CreateParams create_params; | 510 AppWindow::CreateParams create_params; |
510 create_params.window_type = AppWindow::WINDOW_TYPE_V1_PANEL; | 511 create_params.window_type = AppWindow::WINDOW_TYPE_V1_PANEL; |
511 create_params.window_spec.bounds = window_bounds; | 512 create_params.window_spec.bounds = window_bounds; |
512 create_params.focused = saw_focus_key && focused; | 513 create_params.focused = saw_focus_key && focused; |
513 AppWindow* app_window = | 514 AppWindow* app_window = new AppWindow( |
514 new AppWindow(window_profile, new ChromeAppDelegate(), extension()); | 515 window_profile, |
| 516 new ChromeAppDelegate(make_scoped_ptr(new ScopedKeepAlive)), |
| 517 extension()); |
515 AshPanelContents* ash_panel_contents = new AshPanelContents(app_window); | 518 AshPanelContents* ash_panel_contents = new AshPanelContents(app_window); |
516 app_window->Init(urls[0], ash_panel_contents, create_params); | 519 app_window->Init(urls[0], ash_panel_contents, create_params); |
517 SetResult(ash_panel_contents->GetExtensionWindowController() | 520 SetResult(ash_panel_contents->GetExtensionWindowController() |
518 ->CreateWindowValueWithTabs(extension())); | 521 ->CreateWindowValueWithTabs(extension())); |
519 return true; | 522 return true; |
520 } | 523 } |
521 #endif | 524 #endif |
522 std::string title = | 525 std::string title = |
523 web_app::GenerateApplicationNameFromExtensionId(extension_id); | 526 web_app::GenerateApplicationNameFromExtensionId(extension_id); |
524 // Note: Panels ignore all but the first url provided. | 527 // Note: Panels ignore all but the first url provided. |
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 ZoomController::ZoomMode zoom_mode = zoom_controller->zoom_mode(); | 1928 ZoomController::ZoomMode zoom_mode = zoom_controller->zoom_mode(); |
1926 api::tabs::ZoomSettings zoom_settings; | 1929 api::tabs::ZoomSettings zoom_settings; |
1927 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); | 1930 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); |
1928 | 1931 |
1929 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); | 1932 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); |
1930 SendResponse(true); | 1933 SendResponse(true); |
1931 return true; | 1934 return true; |
1932 } | 1935 } |
1933 | 1936 |
1934 } // namespace extensions | 1937 } // namespace extensions |
OLD | NEW |