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

Side by Side Diff: chrome/browser/ui/metro_pin_tab_helper.h

Issue 10993064: Make using WebContentsUserData simpler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_H_
6 #define CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_H_ 6 #define CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_H_
7 7
8 #include "chrome/browser/common/web_contents_user_data.h" 8 #include "chrome/browser/common/web_contents_user_data.h"
9 #include "content/public/browser/web_contents_observer.h" 9 #include "content/public/browser/web_contents_observer.h"
10 10
11 // Per-tab class to help manage metro pinning. 11 // Per-tab class to help manage metro pinning.
12 class MetroPinTabHelper : public content::WebContentsObserver, 12 class MetroPinTabHelper : public content::WebContentsObserver,
13 public WebContentsUserData<MetroPinTabHelper> { 13 public WebContentsUserData<MetroPinTabHelper> {
14 public: 14 public:
15 virtual ~MetroPinTabHelper(); 15 virtual ~MetroPinTabHelper();
16 16
17 bool is_pinned() const { return is_pinned_; } 17 bool is_pinned() const { return is_pinned_; }
18 18
19 void TogglePinnedToStartScreen(); 19 void TogglePinnedToStartScreen();
20 20
21 // content::WebContentsObserver overrides: 21 // content::WebContentsObserver overrides:
22 virtual void DidNavigateMainFrame( 22 virtual void DidNavigateMainFrame(
23 const content::LoadCommittedDetails& details, 23 const content::LoadCommittedDetails& details,
24 const content::FrameNavigateParams& params) OVERRIDE; 24 const content::FrameNavigateParams& params) OVERRIDE;
25 25
26 private: 26 private:
27 explicit MetroPinTabHelper(content::WebContents* tab_contents); 27 explicit MetroPinTabHelper(content::WebContents* tab_contents);
28 static int kUserDataKey;
29 friend class WebContentsUserData<MetroPinTabHelper>; 28 friend class WebContentsUserData<MetroPinTabHelper>;
30 29
31 // Queries the metro driver about the pinned state of the current URL. 30 // Queries the metro driver about the pinned state of the current URL.
32 void UpdatePinnedStateForCurrentURL(); 31 void UpdatePinnedStateForCurrentURL();
33 32
34 // Whether the current URL is pinned to the metro start screen. 33 // Whether the current URL is pinned to the metro start screen.
35 bool is_pinned_; 34 bool is_pinned_;
36 35
37 DISALLOW_COPY_AND_ASSIGN(MetroPinTabHelper); 36 DISALLOW_COPY_AND_ASSIGN(MetroPinTabHelper);
38 }; 37 };
39 38
40 #endif // CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_H_ 39 #endif // CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698