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

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

Issue 10800054: Add pin icon to the omnibar in windows 8 metro mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
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
index 0a16543cdfdffc42f1b389fe0db7a5a0e9988daf..a525c20905ebb65d4c6f05bd621a54ed5069b930 100644
--- a/chrome/browser/ui/metro_pin_tab_helper.cc
+++ b/chrome/browser/ui/metro_pin_tab_helper.cc
@@ -12,9 +12,12 @@
#include "base/win/metro.h"
#endif
+MetroPinTabHelper::Delegate::~Delegate() {}
+
MetroPinTabHelper::MetroPinTabHelper(content::WebContents* web_contents)
: content::WebContentsObserver(web_contents),
- is_pinned_(false) {}
+ is_pinned_(false),
+ delegate_(NULL) {}
MetroPinTabHelper::~MetroPinTabHelper() {}
@@ -40,8 +43,7 @@ void MetroPinTabHelper::TogglePinnedToStartScreen() {
// 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;
+ SetIsPinned(!is_pinned_);
}
#endif
}
@@ -66,9 +68,16 @@ void MetroPinTabHelper::UpdatePinnedStateForCurrentURL() {
}
GURL url = web_contents()->GetURL();
- is_pinned_ = metro_is_pinned_to_start_screen(UTF8ToUTF16(url.spec())) != 0;
+ SetIsPinned(metro_is_pinned_to_start_screen(UTF8ToUTF16(url.spec())) != 0);
VLOG(1) << __FUNCTION__ << " with url " << UTF8ToUTF16(url.spec())
<< " result: " << is_pinned_;
}
#endif
}
+
+void MetroPinTabHelper::SetIsPinned(bool is_pinned) {
+ bool was_pinned = is_pinned_;
+ is_pinned_ = is_pinned;
+ if (delegate_ && is_pinned_ != was_pinned)
+ delegate_->IsPinnedChanged(web_contents(), is_pinned_);
+}

Powered by Google App Engine
This is Rietveld 408576698