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