Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.cc

Issue 1109393011: Pull back windows to the original user desktop when clicking on the correspond window list bubble i… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't append teleport window context menu item for delicated settings window. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h"
6 6
7 #include "ash/wm/window_util.h" 7 #include "ash/wm/window_util.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_finder.h" 9 #include "chrome/browser/ui/browser_finder.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" 11 #include "chrome/browser/ui/tabs/tab_strip_model.h"
12 #include "ui/events/event_constants.h" 12 #include "ui/events/event_constants.h"
13 13
14 #if defined(OS_CHROMEOS)
15 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
16 #endif
17
14 ChromeLauncherAppMenuItemTab::ChromeLauncherAppMenuItemTab( 18 ChromeLauncherAppMenuItemTab::ChromeLauncherAppMenuItemTab(
15 const base::string16 title, 19 const base::string16 title,
16 const gfx::Image* icon, 20 const gfx::Image* icon,
17 content::WebContents* content, 21 content::WebContents* content,
18 bool has_leading_separator) 22 bool has_leading_separator)
19 : ChromeLauncherAppMenuItem(title, icon, has_leading_separator), 23 : ChromeLauncherAppMenuItem(title, icon, has_leading_separator),
20 content::WebContentsObserver(content) { 24 content::WebContentsObserver(content) {
21 } 25 }
22 26
23 bool ChromeLauncherAppMenuItemTab::IsActive() const { 27 bool ChromeLauncherAppMenuItemTab::IsActive() const {
(...skipping 12 matching lines...) Expand all
36 return; 40 return;
37 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); 41 Browser* browser = chrome::FindBrowserWithWebContents(web_contents());
38 if (!browser) 42 if (!browser)
39 return; 43 return;
40 TabStripModel* tab_strip = browser->tab_strip_model(); 44 TabStripModel* tab_strip = browser->tab_strip_model();
41 int index = tab_strip->GetIndexOfWebContents(web_contents()); 45 int index = tab_strip->GetIndexOfWebContents(web_contents());
42 DCHECK_NE(index, TabStripModel::kNoTab); 46 DCHECK_NE(index, TabStripModel::kNoTab);
43 if (event_flags & (ui::EF_SHIFT_DOWN | ui::EF_MIDDLE_MOUSE_BUTTON)) { 47 if (event_flags & (ui::EF_SHIFT_DOWN | ui::EF_MIDDLE_MOUSE_BUTTON)) {
44 tab_strip->CloseWebContentsAt(index, TabStripModel::CLOSE_USER_GESTURE); 48 tab_strip->CloseWebContentsAt(index, TabStripModel::CLOSE_USER_GESTURE);
45 } else { 49 } else {
50 #if defined(OS_CHROMEOS)
51 // In multiprofile scenario we might need to teleport the window back to
52 // the current user desktop.
53 if (chrome::MultiUserWindowManager::GetMultiProfileMode() ==
54 chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED) {
55 aura::Window* window = browser->window()->GetNativeWindow();
56 chrome::MultiUserWindowManager* window_manager =
57 chrome::MultiUserWindowManager::GetInstance();
58 if (!window_manager->IsWindowOnDesktopOfUser(
59 window, window_manager->GetWindowOwner(window)))
Mr4D (OOO till 08-26) 2015/05/03 19:53:45 You need to add {} around this since it's more the
60 window_manager->ShowWindowForUser(
61 window, window_manager->GetWindowOwner(window));
62 }
63 #endif
46 tab_strip->ActivateTabAt(index, false); 64 tab_strip->ActivateTabAt(index, false);
47 browser->window()->Show(); 65 browser->window()->Show();
48 // Need this check to prevent unit tests from crashing. 66 // Need this check to prevent unit tests from crashing.
49 if (browser->window()->GetNativeWindow()) 67 if (browser->window()->GetNativeWindow())
50 ash::wm::ActivateWindow(browser->window()->GetNativeWindow()); 68 ash::wm::ActivateWindow(browser->window()->GetNativeWindow());
51 } 69 }
52 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698