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_finder.h" | 11 #include "chrome/browser/ui/browser_finder.h" |
12 #include "chrome/browser/ui/fullscreen_controller.h" | 12 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | |
14 | 13 |
15 namespace { | 14 namespace { |
16 | 15 |
17 void NewMetroWindow(Browser* source_browser, Profile* profile) { | 16 void NewMetroWindow(Browser* source_browser, Profile* profile) { |
18 typedef void (*FlipFrameWindows)(); | 17 typedef void (*FlipFrameWindows)(); |
19 | 18 |
20 static FlipFrameWindows flip_window_fn = reinterpret_cast<FlipFrameWindows>( | 19 static FlipFrameWindows flip_window_fn = reinterpret_cast<FlipFrameWindows>( |
21 ::GetProcAddress(base::win::GetMetroModule(), "FlipFrameWindows")); | 20 ::GetProcAddress(base::win::GetMetroModule(), "FlipFrameWindows")); |
22 DCHECK(flip_window_fn); | 21 DCHECK(flip_window_fn); |
23 | 22 |
(...skipping 23 matching lines...) Expand all Loading... |
47 } | 46 } |
48 | 47 |
49 void Browser::NewIncognitoWindow() { | 48 void Browser::NewIncognitoWindow() { |
50 if (base::win::GetMetroModule()) { | 49 if (base::win::GetMetroModule()) { |
51 NewMetroWindow(this, profile_->GetOffTheRecordProfile()); | 50 NewMetroWindow(this, profile_->GetOffTheRecordProfile()); |
52 return; | 51 return; |
53 } | 52 } |
54 NewEmptyWindow(profile_->GetOffTheRecordProfile()); | 53 NewEmptyWindow(profile_->GetOffTheRecordProfile()); |
55 } | 54 } |
56 | 55 |
57 void Browser::SetMetroSnapMode(bool enable) { | |
58 fullscreen_controller_->SetMetroSnapMode(enable); | |
59 } | |
60 | |
61 void Browser::PinCurrentPageToStartScreen() { | 56 void Browser::PinCurrentPageToStartScreen() { |
62 HMODULE metro_module = base::win::GetMetroModule(); | 57 HMODULE metro_module = base::win::GetMetroModule(); |
63 if (metro_module) { | 58 if (metro_module) { |
64 GURL url; | 59 GURL url; |
65 string16 title; | 60 string16 title; |
66 TabContents* tab = GetActiveTabContents(); | 61 TabContents* tab = GetActiveTabContents(); |
67 bookmark_utils::GetURLAndTitleToBookmark(tab->web_contents(), &url, &title); | 62 bookmark_utils::GetURLAndTitleToBookmark(tab->web_contents(), &url, &title); |
68 | 63 |
69 typedef BOOL (*MetroPinUrlToStartScreen)(string16, string16); | 64 typedef BOOL (*MetroPinUrlToStartScreen)(string16, string16); |
70 MetroPinUrlToStartScreen metro_pin_url_to_start_screen = | 65 MetroPinUrlToStartScreen metro_pin_url_to_start_screen = |
71 reinterpret_cast<MetroPinUrlToStartScreen>( | 66 reinterpret_cast<MetroPinUrlToStartScreen>( |
72 ::GetProcAddress(metro_module, "MetroPinUrlToStartScreen")); | 67 ::GetProcAddress(metro_module, "MetroPinUrlToStartScreen")); |
73 if (!metro_pin_url_to_start_screen) { | 68 if (!metro_pin_url_to_start_screen) { |
74 NOTREACHED(); | 69 NOTREACHED(); |
75 return; | 70 return; |
76 } | 71 } |
77 | 72 |
78 VLOG(1) << __FUNCTION__ << " calling pin with title: " << title | 73 VLOG(1) << __FUNCTION__ << " calling pin with title: " << title |
79 << " and url " << UTF8ToUTF16(url.spec()); | 74 << " and url " << UTF8ToUTF16(url.spec()); |
80 metro_pin_url_to_start_screen(title, UTF8ToUTF16(url.spec())); | 75 metro_pin_url_to_start_screen(title, UTF8ToUTF16(url.spec())); |
81 return; | 76 return; |
82 } | 77 } |
83 } | 78 } |
OLD | NEW |