Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / views / website_settings / permission_selector_view.h
blob20391ac9a2b68162e508763aa72f1f3b36589578
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSION_SELECTOR_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSION_SELECTOR_VIEW_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/observer_list.h"
12 #include "base/strings/string16.h"
13 #include "chrome/browser/ui/views/website_settings/permission_selector_view_observer.h"
14 #include "chrome/browser/ui/website_settings/permission_menu_model.h"
15 #include "chrome/browser/ui/website_settings/website_settings_ui.h"
16 #include "components/content_settings/core/common/content_settings.h"
17 #include "components/content_settings/core/common/content_settings_types.h"
18 #include "ui/views/controls/button/menu_button_listener.h"
19 #include "ui/views/view.h"
21 namespace internal {
22 class PermissionMenuButton;
25 namespace views {
26 class ImageView;
27 class MenuRunner;
30 // A custom view for selecting a permission setting for the given permission
31 // |type|.
32 class PermissionSelectorView : public views::View {
33 public:
34 PermissionSelectorView(const GURL& url,
35 const WebsiteSettingsUI::PermissionInfo& permission);
37 void AddObserver(PermissionSelectorViewObserver* observer);
39 void PermissionChanged(const WebsiteSettingsUI::PermissionInfo& permission);
41 protected:
42 // Overridden from views::View.
43 void ChildPreferredSizeChanged(View* child) override;
45 private:
46 ~PermissionSelectorView() override;
48 // Model for the permission's menu.
49 scoped_ptr<PermissionMenuModel> menu_model_;
51 views::ImageView* icon_; // Owned by the views hierachy.
52 internal::PermissionMenuButton* menu_button_; // Owned by the views hierachy.
54 base::ObserverList<PermissionSelectorViewObserver, false> observer_list_;
56 DISALLOW_COPY_AND_ASSIGN(PermissionSelectorView);
59 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSION_SELECTOR_VIEW_H_