| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" | 5 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/common/shelf/shelf_delegate.h" | 9 #include "ash/common/shelf/shelf_delegate.h" |
| 10 #include "ash/common/shelf/shelf_model.h" | 10 #include "ash/common/shelf/shelf_model.h" |
| 11 #include "ash/common/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
| 12 #include "ash/common/wm_window.h" | 12 #include "ash/common/wm_window.h" |
| 13 #include "ash/common/wm_window_property.h" | |
| 14 #include "ash/public/cpp/shelf_application_menu_item.h" | 13 #include "ash/public/cpp/shelf_application_menu_item.h" |
| 15 #include "ash/resources/grit/ash_resources.h" | 14 #include "ash/resources/grit/ash_resources.h" |
| 15 #include "ash/wm/window_properties.h" |
| 16 #include "ash/wm/window_util.h" | 16 #include "ash/wm/window_util.h" |
| 17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.h
" | 19 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.h
" |
| 20 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h" | 20 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h" |
| 21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 22 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" | 22 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" |
| 23 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" | 23 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" |
| 24 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
| 25 #include "chrome/browser/ui/browser_commands.h" | 25 #include "chrome/browser/ui/browser_commands.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 void BrowserShortcutLauncherItemController::SetShelfIDForBrowserWindowContents( | 126 void BrowserShortcutLauncherItemController::SetShelfIDForBrowserWindowContents( |
| 127 Browser* browser, | 127 Browser* browser, |
| 128 content::WebContents* web_contents) { | 128 content::WebContents* web_contents) { |
| 129 // We need to set the window ShelfID for V1 applications since they are | 129 // We need to set the window ShelfID for V1 applications since they are |
| 130 // content which might change and as such change the application type. | 130 // content which might change and as such change the application type. |
| 131 if (!browser || !IsBrowserFromActiveUser(browser) || | 131 if (!browser || !IsBrowserFromActiveUser(browser) || |
| 132 IsSettingsBrowser(browser)) | 132 IsSettingsBrowser(browser)) |
| 133 return; | 133 return; |
| 134 | 134 |
| 135 ash::WmWindow::Get(browser->window()->GetNativeWindow()) | 135 browser->window()->GetNativeWindow()->SetProperty( |
| 136 ->SetIntProperty( | 136 ash::kShelfIDKey, |
| 137 ash::WmWindowProperty::SHELF_ID, | 137 launcher_controller()->GetShelfIDForWebContents(web_contents)); |
| 138 launcher_controller()->GetShelfIDForWebContents(web_contents)); | |
| 139 } | 138 } |
| 140 | 139 |
| 141 ash::ShelfAction BrowserShortcutLauncherItemController::ItemSelected( | 140 ash::ShelfAction BrowserShortcutLauncherItemController::ItemSelected( |
| 142 ui::EventType event_type, | 141 ui::EventType event_type, |
| 143 int event_flags, | 142 int event_flags, |
| 144 int64_t display_id, | 143 int64_t display_id, |
| 145 ash::ShelfLaunchSource source) { | 144 ash::ShelfLaunchSource source) { |
| 146 if (event_flags & ui::EF_CONTROL_DOWN) { | 145 if (event_flags & ui::EF_CONTROL_DOWN) { |
| 147 chrome::NewEmptyWindow(launcher_controller()->profile()); | 146 chrome::NewEmptyWindow(launcher_controller()->profile()); |
| 148 return ash::SHELF_ACTION_NEW_WINDOW_CREATED; | 147 return ash::SHELF_ACTION_NEW_WINDOW_CREATED; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 !browser->window()->IsMinimized()) { | 315 !browser->window()->IsMinimized()) { |
| 317 continue; | 316 continue; |
| 318 } | 317 } |
| 319 if (!IsBrowserRepresentedInBrowserList(browser) && | 318 if (!IsBrowserRepresentedInBrowserList(browser) && |
| 320 !browser->is_type_tabbed()) | 319 !browser->is_type_tabbed()) |
| 321 continue; | 320 continue; |
| 322 active_browsers.push_back(browser); | 321 active_browsers.push_back(browser); |
| 323 } | 322 } |
| 324 return active_browsers; | 323 return active_browsers; |
| 325 } | 324 } |
| OLD | NEW |