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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 void AssignOptionalValue(const scoped_ptr<T>& source, | 177 void AssignOptionalValue(const scoped_ptr<T>& source, |
178 scoped_ptr<T>& destination) { | 178 scoped_ptr<T>& destination) { |
179 if (source.get()) { | 179 if (source.get()) { |
180 destination.reset(new T(*source.get())); | 180 destination.reset(new T(*source.get())); |
181 } | 181 } |
182 } | 182 } |
183 | 183 |
184 ui::WindowShowState ConvertToWindowShowState(windows::WindowState state) { | 184 ui::WindowShowState ConvertToWindowShowState(windows::WindowState state) { |
185 switch (state) { | 185 switch (state) { |
186 case windows::WINDOW_STATE_NORMAL: | 186 case windows::WINDOW_STATE_NORMAL: |
| 187 case windows::WINDOW_STATE_DOCKED: |
187 return ui::SHOW_STATE_NORMAL; | 188 return ui::SHOW_STATE_NORMAL; |
188 case windows::WINDOW_STATE_MINIMIZED: | 189 case windows::WINDOW_STATE_MINIMIZED: |
189 return ui::SHOW_STATE_MINIMIZED; | 190 return ui::SHOW_STATE_MINIMIZED; |
190 case windows::WINDOW_STATE_MAXIMIZED: | 191 case windows::WINDOW_STATE_MAXIMIZED: |
191 return ui::SHOW_STATE_MAXIMIZED; | 192 return ui::SHOW_STATE_MAXIMIZED; |
192 case windows::WINDOW_STATE_FULLSCREEN: | 193 case windows::WINDOW_STATE_FULLSCREEN: |
193 return ui::SHOW_STATE_FULLSCREEN; | 194 return ui::SHOW_STATE_FULLSCREEN; |
194 case windows::WINDOW_STATE_NONE: | 195 case windows::WINDOW_STATE_NONE: |
195 return ui::SHOW_STATE_DEFAULT; | 196 return ui::SHOW_STATE_DEFAULT; |
196 } | 197 } |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 } | 522 } |
522 | 523 |
523 if (create_panel) { | 524 if (create_panel) { |
524 if (urls.empty()) | 525 if (urls.empty()) |
525 urls.push_back(GURL(chrome::kChromeUINewTabURL)); | 526 urls.push_back(GURL(chrome::kChromeUINewTabURL)); |
526 | 527 |
527 #if defined(USE_ASH) | 528 #if defined(USE_ASH) |
528 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) { | 529 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) { |
529 AppWindow::CreateParams create_params; | 530 AppWindow::CreateParams create_params; |
530 create_params.window_type = AppWindow::WINDOW_TYPE_V1_PANEL; | 531 create_params.window_type = AppWindow::WINDOW_TYPE_V1_PANEL; |
| 532 create_params.window_key = extension_id; |
531 create_params.window_spec.bounds = window_bounds; | 533 create_params.window_spec.bounds = window_bounds; |
532 create_params.focused = saw_focus_key && focused; | 534 create_params.focused = saw_focus_key && focused; |
533 AppWindow* app_window = new AppWindow( | 535 AppWindow* app_window = new AppWindow( |
534 window_profile, | 536 window_profile, |
535 new ChromeAppDelegate(make_scoped_ptr(new ScopedKeepAlive)), | 537 new ChromeAppDelegate(make_scoped_ptr(new ScopedKeepAlive)), |
536 extension()); | 538 extension()); |
537 AshPanelContents* ash_panel_contents = new AshPanelContents(app_window); | 539 AshPanelContents* ash_panel_contents = new AshPanelContents(app_window); |
538 app_window->Init(urls[0], ash_panel_contents, create_params); | 540 app_window->Init(urls[0], ash_panel_contents, create_params); |
539 SetResult(ash_panel_contents->GetExtensionWindowController() | 541 SetResult(ash_panel_contents->GetExtensionWindowController() |
540 ->CreateWindowValueWithTabs(extension())); | 542 ->CreateWindowValueWithTabs(extension())); |
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1971 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); | 1973 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); |
1972 zoom_settings.default_zoom_factor.reset(new double( | 1974 zoom_settings.default_zoom_factor.reset(new double( |
1973 content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()))); | 1975 content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()))); |
1974 | 1976 |
1975 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); | 1977 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); |
1976 SendResponse(true); | 1978 SendResponse(true); |
1977 return true; | 1979 return true; |
1978 } | 1980 } |
1979 | 1981 |
1980 } // namespace extensions | 1982 } // namespace extensions |
OLD | NEW |