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

Unified Diff: chrome/browser/ui/metro_pin_tab_helper.cc

Issue 11198025: Site specific secondary tiles for Windows 8. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Feedback Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/metro_pin_tab_helper.h ('k') | chrome/browser/ui/metro_pin_tab_helper_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/metro_pin_tab_helper.cc
diff --git a/chrome/browser/ui/metro_pin_tab_helper.cc b/chrome/browser/ui/metro_pin_tab_helper.cc
deleted file mode 100644
index 7644355c6a5b8506d5e333410e3cdf638f928b9b..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/metro_pin_tab_helper.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/metro_pin_tab_helper.h"
-
-#include "base/logging.h"
-#include "base/utf_string_conversions.h"
-#include "content/public/browser/web_contents.h"
-
-#if defined(OS_WIN)
-#include "base/win/metro.h"
-#endif
-
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(MetroPinTabHelper)
-
-MetroPinTabHelper::MetroPinTabHelper(content::WebContents* web_contents)
- : content::WebContentsObserver(web_contents),
- is_pinned_(false) {}
-
-MetroPinTabHelper::~MetroPinTabHelper() {}
-
-void MetroPinTabHelper::TogglePinnedToStartScreen() {
-#if defined(OS_WIN)
- HMODULE metro_module = base::win::GetMetroModule();
- if (metro_module) {
- typedef void (*MetroTogglePinnedToStartScreen)(const string16&,
- const string16&);
- MetroTogglePinnedToStartScreen metro_toggle_pinned_to_start_screen =
- reinterpret_cast<MetroTogglePinnedToStartScreen>(
- ::GetProcAddress(metro_module, "MetroTogglePinnedToStartScreen"));
- if (!metro_toggle_pinned_to_start_screen) {
- NOTREACHED();
- return;
- }
-
- GURL url = web_contents()->GetURL();
- string16 title = web_contents()->GetTitle();
- VLOG(1) << __FUNCTION__ << " calling pin with title: " << title
- << " and url " << UTF8ToUTF16(url.spec());
- metro_toggle_pinned_to_start_screen(title, UTF8ToUTF16(url.spec()));
- // TODO(benwells): This will update the state incorrectly if the user
- // cancels. To fix this some sort of callback needs to be introduced as
- // the pinning happens on another thread.
- is_pinned_ = !is_pinned_;
- return;
- }
-#endif
-}
-
-void MetroPinTabHelper::DidNavigateMainFrame(
- const content::LoadCommittedDetails& /*details*/,
- const content::FrameNavigateParams& /*params*/) {
- UpdatePinnedStateForCurrentURL();
-}
-
-void MetroPinTabHelper::UpdatePinnedStateForCurrentURL() {
-#if defined(OS_WIN)
- HMODULE metro_module = base::win::GetMetroModule();
- if (metro_module) {
- typedef BOOL (*MetroIsPinnedToStartScreen)(const string16&);
- MetroIsPinnedToStartScreen metro_is_pinned_to_start_screen =
- reinterpret_cast<MetroIsPinnedToStartScreen>(
- ::GetProcAddress(metro_module, "MetroIsPinnedToStartScreen"));
- if (!metro_is_pinned_to_start_screen) {
- NOTREACHED();
- return;
- }
-
- GURL url = web_contents()->GetURL();
- is_pinned_ = metro_is_pinned_to_start_screen(UTF8ToUTF16(url.spec())) != 0;
- VLOG(1) << __FUNCTION__ << " with url " << UTF8ToUTF16(url.spec())
- << " result: " << is_pinned_;
- }
-#endif
-}
« no previous file with comments | « chrome/browser/ui/metro_pin_tab_helper.h ('k') | chrome/browser/ui/metro_pin_tab_helper_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698