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