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/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "base/win/metro.h" | 8 #include "base/win/metro.h" |
9 #include "chrome/browser/bookmarks/bookmark_utils.h" | 9 #include "chrome/browser/bookmarks/bookmark_utils.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/ui/browser_commands.h" | 11 #include "chrome/browser/ui/browser_commands.h" |
12 #include "chrome/browser/ui/browser_finder.h" | 12 #include "chrome/browser/ui/browser_finder.h" |
13 #include "chrome/browser/ui/browser_tabstrip.h" | 13 #include "chrome/browser/ui/browser_tabstrip.h" |
14 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 14 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
15 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 15 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 void NewMetroWindow(Browser* source_browser, Profile* profile) { | 19 void NewMetroWindow(Browser* source_browser, Profile* profile) { |
20 typedef void (*FlipFrameWindows)(); | 20 typedef void (*FlipFrameWindows)(); |
21 | 21 |
22 static FlipFrameWindows flip_window_fn = reinterpret_cast<FlipFrameWindows>( | 22 static FlipFrameWindows flip_window_fn = reinterpret_cast<FlipFrameWindows>( |
23 ::GetProcAddress(base::win::GetMetroModule(), "FlipFrameWindows")); | 23 ::GetProcAddress(base::win::GetMetroModule(), "FlipFrameWindows")); |
24 DCHECK(flip_window_fn); | 24 DCHECK(flip_window_fn); |
25 | 25 |
26 Browser* browser = browser::FindTabbedBrowser(profile, false); | 26 chrome::HostDesktopType host_desktop_type = |
| 27 source_browser->host_desktop_type(); |
| 28 Browser* browser = |
| 29 browser::FindTabbedBrowser(profile, false, host_desktop_type); |
| 30 |
27 if (!browser) { | 31 if (!browser) { |
28 chrome::OpenEmptyWindow(profile); | 32 chrome::OpenEmptyWindow(profile); |
29 return; | 33 return; |
30 } | 34 } |
31 | 35 |
32 chrome::NewTab(browser); | 36 chrome::NewTab(browser); |
33 | 37 |
34 if (browser != source_browser) { | 38 if (browser != source_browser) { |
35 // Tell the metro_driver to flip our window. This causes the current | 39 // Tell the metro_driver to flip our window. This causes the current |
36 // browser window to be hidden and the next window to be shown. | 40 // browser window to be hidden and the next window to be shown. |
(...skipping 19 matching lines...) Expand all Loading... |
56 return; | 60 return; |
57 } | 61 } |
58 NewEmptyWindow(browser->profile()->GetOffTheRecordProfile()); | 62 NewEmptyWindow(browser->profile()->GetOffTheRecordProfile()); |
59 } | 63 } |
60 | 64 |
61 } // namespace chrome | 65 } // namespace chrome |
62 | 66 |
63 void Browser::SetMetroSnapMode(bool enable) { | 67 void Browser::SetMetroSnapMode(bool enable) { |
64 fullscreen_controller_->SetMetroSnapMode(enable); | 68 fullscreen_controller_->SetMetroSnapMode(enable); |
65 } | 69 } |
OLD | NEW |