[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / views / website_settings / permission_selector_view.h
blobd963307a5c055c5672a80dc2c9f24699a9a67441
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 "chrome/common/content_settings.h"
17 #include "chrome/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 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE;
45 private:
46 virtual ~PermissionSelectorView();
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 ObserverList<PermissionSelectorViewObserver, false> observer_list_;
56 DISALLOW_COPY_AND_ASSIGN(PermissionSelectorView);
59 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSION_SELECTOR_VIEW_H_