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 "apps/shell_window.h" | 11 #include "apps/app_window.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/memory/ref_counted_memory.h" | 15 #include "base/memory/ref_counted_memory.h" |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
18 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
19 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 #include "skia/ext/platform_canvas.h" | 83 #include "skia/ext/platform_canvas.h" |
84 #include "third_party/skia/include/core/SkBitmap.h" | 84 #include "third_party/skia/include/core/SkBitmap.h" |
85 #include "ui/base/models/list_selection_model.h" | 85 #include "ui/base/models/list_selection_model.h" |
86 #include "ui/base/ui_base_types.h" | 86 #include "ui/base/ui_base_types.h" |
87 | 87 |
88 #if defined(OS_WIN) | 88 #if defined(OS_WIN) |
89 #include "win8/util/win8_util.h" | 89 #include "win8/util/win8_util.h" |
90 #endif // OS_WIN | 90 #endif // OS_WIN |
91 | 91 |
92 #if defined(USE_ASH) | 92 #if defined(USE_ASH) |
93 #include "apps/shell_window_registry.h" | 93 #include "apps/app_window_registry.h" |
94 #include "ash/ash_switches.h" | 94 #include "ash/ash_switches.h" |
95 #include "chrome/browser/extensions/api/tabs/ash_panel_contents.h" | 95 #include "chrome/browser/extensions/api/tabs/ash_panel_contents.h" |
96 #endif | 96 #endif |
97 | 97 |
98 using apps::ShellWindow; | 98 using apps::AppWindow; |
99 using content::BrowserThread; | 99 using content::BrowserThread; |
100 using content::NavigationController; | 100 using content::NavigationController; |
101 using content::NavigationEntry; | 101 using content::NavigationEntry; |
102 using content::OpenURLParams; | 102 using content::OpenURLParams; |
103 using content::Referrer; | 103 using content::Referrer; |
104 using content::WebContents; | 104 using content::WebContents; |
105 | 105 |
106 namespace extensions { | 106 namespace extensions { |
107 | 107 |
108 namespace windows = api::windows; | 108 namespace windows = api::windows; |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 saw_focus_key = true; | 516 saw_focus_key = true; |
517 } | 517 } |
518 } | 518 } |
519 | 519 |
520 if (create_panel) { | 520 if (create_panel) { |
521 if (urls.empty()) | 521 if (urls.empty()) |
522 urls.push_back(GURL(chrome::kChromeUINewTabURL)); | 522 urls.push_back(GURL(chrome::kChromeUINewTabURL)); |
523 | 523 |
524 #if defined(USE_ASH) | 524 #if defined(USE_ASH) |
525 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) { | 525 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) { |
526 ShellWindow::CreateParams create_params; | 526 AppWindow::CreateParams create_params; |
527 create_params.window_type = ShellWindow::WINDOW_TYPE_V1_PANEL; | 527 create_params.window_type = AppWindow::WINDOW_TYPE_V1_PANEL; |
528 create_params.bounds = window_bounds; | 528 create_params.bounds = window_bounds; |
529 create_params.focused = saw_focus_key && focused; | 529 create_params.focused = saw_focus_key && focused; |
530 ShellWindow* shell_window = new ShellWindow( | 530 AppWindow* app_window = new AppWindow( |
531 window_profile, new ChromeShellWindowDelegate(), | 531 window_profile, new ChromeShellWindowDelegate(), GetExtension()); |
532 GetExtension()); | 532 AshPanelContents* ash_panel_contents = new AshPanelContents(app_window); |
533 AshPanelContents* ash_panel_contents = new AshPanelContents(shell_window); | 533 app_window->Init(urls[0], ash_panel_contents, create_params); |
534 shell_window->Init(urls[0], ash_panel_contents, create_params); | |
535 SetResult(ash_panel_contents->GetExtensionWindowController()-> | 534 SetResult(ash_panel_contents->GetExtensionWindowController()-> |
536 CreateWindowValueWithTabs(GetExtension())); | 535 CreateWindowValueWithTabs(GetExtension())); |
537 return true; | 536 return true; |
538 } | 537 } |
539 #endif | 538 #endif |
540 std::string title = | 539 std::string title = |
541 web_app::GenerateApplicationNameFromExtensionId(extension_id); | 540 web_app::GenerateApplicationNameFromExtensionId(extension_id); |
542 // Note: Panels ignore all but the first url provided. | 541 // Note: Panels ignore all but the first url provided. |
543 Panel* panel = PanelManager::GetInstance()->CreatePanel( | 542 Panel* panel = PanelManager::GetInstance()->CreatePanel( |
544 title, window_profile, urls[0], window_bounds, panel_create_mode); | 543 title, window_profile, urls[0], window_bounds, panel_create_mode); |
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1907 execute_tab_id_ = tab_id; | 1906 execute_tab_id_ = tab_id; |
1908 details_ = details.Pass(); | 1907 details_ = details.Pass(); |
1909 return true; | 1908 return true; |
1910 } | 1909 } |
1911 | 1910 |
1912 bool TabsInsertCSSFunction::ShouldInsertCSS() const { | 1911 bool TabsInsertCSSFunction::ShouldInsertCSS() const { |
1913 return true; | 1912 return true; |
1914 } | 1913 } |
1915 | 1914 |
1916 } // namespace extensions | 1915 } // namespace extensions |
OLD | NEW |