summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/frame/web_app_left_header_view_ash.h
blob: 21eb01ad8318e407e3dbdcb4edde5f60c947da3a (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright 2014 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_VIEWS_FRAME_WEB_APP_LEFT_HEADER_VIEW_ASH_H_
#define CHROME_BROWSER_UI_VIEWS_FRAME_WEB_APP_LEFT_HEADER_VIEW_ASH_H_

#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "ui/views/controls/button/button.h"

class BrowserView;

namespace ash {
class FrameCaptionButton;
}

namespace views {
class ImageButton;
}

// WebAppLeftHeaderView is a container view for any icons on the left of the
// frame used for web app style windows. It contains a back button and a
// location icon.
class WebAppLeftHeaderView : public views::View,
                             public views::ButtonListener {
 public:
  static const char kViewClassName[];

  explicit WebAppLeftHeaderView(BrowserView* browser_view);
  ~WebAppLeftHeaderView() override;

  // Updates the view.
  void Update();

  // Update whether to paint the header view as active or not.
  void SetPaintAsActive(bool active);

  views::View* GetLocationIconView() const;

 private:
  FRIEND_TEST_ALL_PREFIXES(WebAppLeftHeaderViewTest, BackButton);
  FRIEND_TEST_ALL_PREFIXES(WebAppLeftHeaderViewTest, LocationIcon);

  // views::View:
  const char* GetClassName() const override;

  // views::ButtonListener:
  void ButtonPressed(views::Button* sender, const ui::Event& event) override;

  // Ask the browser to show the website settings dialog.
  void ShowWebsiteSettings() const;

  // Update the state of the back button.
  void UpdateBackButtonState(bool enabled);

  // The BrowserView for the frame.
  BrowserView* browser_view_;

  // The back button.
  ash::FrameCaptionButton* back_button_;

  // The location icon indicator. Shows the connection security status and
  // allows the user to bring up the website settings dialog.
  ash::FrameCaptionButton* location_icon_;

  DISALLOW_COPY_AND_ASSIGN(WebAppLeftHeaderView);
};

#endif  // CHROME_BROWSER_UI_VIEWS_FRAME_WEB_APP_LEFT_HEADER_VIEW_ASH_H_