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 #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 "content/public/browser/web_contents_observer.h" | 8 #include "content/public/browser/web_contents_observer.h" |
9 | 9 |
10 class MetroPinnedStateObserver; | |
11 | |
10 // Per-tab class to help manage metro pinning. | 12 // Per-tab class to help manage metro pinning. |
11 class MetroPinTabHelper : public content::WebContentsObserver { | 13 class MetroPinTabHelper : public content::WebContentsObserver { |
12 public: | 14 public: |
13 explicit MetroPinTabHelper(content::WebContents* tab_contents); | 15 explicit MetroPinTabHelper(content::WebContents* web_contents); |
14 virtual ~MetroPinTabHelper(); | 16 virtual ~MetroPinTabHelper(); |
15 | 17 |
16 bool is_pinned() const { return is_pinned_; } | 18 bool is_pinned() const { return is_pinned_; } |
17 | 19 |
20 void set_observer(MetroPinnedStateObserver* observer) { | |
21 observer_ = observer; | |
22 } | |
23 | |
18 void TogglePinnedToStartScreen(); | 24 void TogglePinnedToStartScreen(); |
19 | 25 |
20 // content::WebContentsObserver overrides: | 26 // content::WebContentsObserver overrides: |
21 virtual void DidNavigateMainFrame( | 27 virtual void DidNavigateMainFrame( |
22 const content::LoadCommittedDetails& details, | 28 const content::LoadCommittedDetails& details, |
23 const content::FrameNavigateParams& params) OVERRIDE; | 29 const content::FrameNavigateParams& params) OVERRIDE; |
24 | 30 |
25 private: | 31 private: |
26 // Queries the metro driver about the pinned state of the current URL. | 32 // Queries the metro driver about the pinned state of the current URL. |
27 void UpdatePinnedStateForCurrentURL(); | 33 void UpdatePinnedStateForCurrentURL(); |
28 | 34 |
35 // Update the pinned state and notify the delegate. | |
36 void SetIsPinned(bool is_pinned); | |
37 | |
29 // Whether the current URL is pinned to the metro start screen. | 38 // Whether the current URL is pinned to the metro start screen. |
30 bool is_pinned_; | 39 bool is_pinned_; |
31 | 40 |
41 // The observer that we inform when the is_pinned_ state changes. | |
sky
2012/07/23 16:02:17
Use |s around references to members and arguments.
| |
42 MetroPinnedStateObserver* observer_; | |
43 | |
32 DISALLOW_COPY_AND_ASSIGN(MetroPinTabHelper); | 44 DISALLOW_COPY_AND_ASSIGN(MetroPinTabHelper); |
33 }; | 45 }; |
34 | 46 |
35 #endif // CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_H_ | 47 #endif // CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_H_ |
OLD | NEW |