summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/metro_pin_tab_helper.h
blob: 450c8e3f202a4430f10b7fb4f7d501fa83ec692c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_H_
#define CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_H_

#include "chrome/browser/common/web_contents_user_data.h"
#include "content/public/browser/web_contents_observer.h"

// Per-tab class to help manage metro pinning.
class MetroPinTabHelper : public content::WebContentsObserver,
                          public WebContentsUserData<MetroPinTabHelper> {
 public:
  virtual ~MetroPinTabHelper();

  bool is_pinned() const { return is_pinned_; }

  void TogglePinnedToStartScreen();

  // content::WebContentsObserver overrides:
  virtual void DidNavigateMainFrame(
      const content::LoadCommittedDetails& details,
      const content::FrameNavigateParams& params) OVERRIDE;

 private:
  explicit MetroPinTabHelper(content::WebContents* tab_contents);
  friend class WebContentsUserData<MetroPinTabHelper>;

  // Queries the metro driver about the pinned state of the current URL.
  void UpdatePinnedStateForCurrentURL();

  // Whether the current URL is pinned to the metro start screen.
  bool is_pinned_;

  DISALLOW_COPY_AND_ASSIGN(MetroPinTabHelper);
};

#endif  // CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_H_