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 #include "content/public/browser/web_contents_user_data.h" | 9 #include "content/public/browser/web_contents_user_data.h" |
10 | 10 |
| 11 class SkBitmap; |
| 12 |
11 // Per-tab class to help manage metro pinning. | 13 // Per-tab class to help manage metro pinning. |
12 class MetroPinTabHelper | 14 class MetroPinTabHelper |
13 : public content::WebContentsObserver, | 15 : public content::WebContentsObserver, |
14 public content::WebContentsUserData<MetroPinTabHelper> { | 16 public content::WebContentsUserData<MetroPinTabHelper> { |
15 public: | 17 public: |
16 virtual ~MetroPinTabHelper(); | 18 virtual ~MetroPinTabHelper(); |
17 | 19 |
18 bool is_pinned() const { return is_pinned_; } | 20 bool is_pinned() const { return is_pinned_; } |
19 | 21 |
20 void TogglePinnedToStartScreen(); | 22 void TogglePinnedToStartScreen(); |
21 | 23 |
22 // content::WebContentsObserver overrides: | 24 // content::WebContentsObserver overrides: |
23 virtual void DidNavigateMainFrame( | 25 virtual void DidNavigateMainFrame( |
24 const content::LoadCommittedDetails& details, | 26 const content::LoadCommittedDetails& details, |
25 const content::FrameNavigateParams& params) OVERRIDE; | 27 const content::FrameNavigateParams& params) OVERRIDE; |
26 | 28 |
27 private: | 29 private: |
28 explicit MetroPinTabHelper(content::WebContents* tab_contents); | 30 explicit MetroPinTabHelper(content::WebContents* tab_contents); |
29 friend class content::WebContentsUserData<MetroPinTabHelper>; | 31 friend class content::WebContentsUserData<MetroPinTabHelper>; |
30 | 32 |
31 // Queries the metro driver about the pinned state of the current URL. | 33 // Queries the metro driver about the pinned state of the current URL. |
32 void UpdatePinnedStateForCurrentURL(); | 34 void UpdatePinnedStateForCurrentURL(); |
33 | 35 |
| 36 void PinPageToStartScreen(const string16& title, |
| 37 const string16& url, |
| 38 const SkBitmap* bitmap); |
| 39 void UnPinPageFromStartScreen(); |
| 40 |
34 // Whether the current URL is pinned to the metro start screen. | 41 // Whether the current URL is pinned to the metro start screen. |
35 bool is_pinned_; | 42 bool is_pinned_; |
36 | 43 |
37 DISALLOW_COPY_AND_ASSIGN(MetroPinTabHelper); | 44 DISALLOW_COPY_AND_ASSIGN(MetroPinTabHelper); |
38 }; | 45 }; |
39 | 46 |
40 #endif // CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_H_ | 47 #endif // CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_H_ |
OLD | NEW |