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