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_VIEWS_INFOBARS_MEDIA_STREAM_INFOBAR_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_MEDIA_STREAM_INFOBAR_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_MEDIA_STREAM_INFOBAR_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_MEDIA_STREAM_INFOBAR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/infobars/infobar_delegate.h" | 9 #include "chrome/browser/infobars/infobar_delegate.h" |
10 #include "chrome/browser/media/media_stream_devices_menu_model.h" | 10 #include "chrome/browser/media/media_stream_devices_menu_model.h" |
11 #include "chrome/browser/ui/views/infobars/infobar_background.h" | 11 #include "chrome/browser/ui/views/infobars/infobar_background.h" |
12 #include "chrome/browser/ui/views/infobars/infobar_view.h" | 12 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
13 #include "ui/views/controls/button/menu_button_delegate.h" | 13 #include "ui/views/controls/button/menu_button_listener.h" |
14 | 14 |
15 class MediaStreamInfoBarDelegate; | 15 class MediaStreamInfoBarDelegate; |
16 | 16 |
17 namespace views { | 17 namespace views { |
18 class MenuButton; | 18 class MenuButton; |
19 } | 19 } |
20 | 20 |
21 // Views implementation of the Media Stream InfoBar, which asks the user whether | 21 // Views implementation of the Media Stream InfoBar, which asks the user whether |
22 // he wants to grant access to his camera/microphone to the current webpage. It | 22 // he wants to grant access to his camera/microphone to the current webpage. It |
23 // also provides a way for the user to select which device(s) will be used by | 23 // also provides a way for the user to select which device(s) will be used by |
24 // the page. | 24 // the page. |
25 class MediaStreamInfoBar : public InfoBarView, | 25 class MediaStreamInfoBar : public InfoBarView, |
26 public views::MenuButtonDelegate { | 26 public views::MenuButtonListener { |
27 public: | 27 public: |
28 MediaStreamInfoBar(InfoBarTabHelper* contents, | 28 MediaStreamInfoBar(InfoBarTabHelper* contents, |
29 MediaStreamInfoBarDelegate* delegate); | 29 MediaStreamInfoBarDelegate* delegate); |
30 | 30 |
31 private: | 31 private: |
32 virtual ~MediaStreamInfoBar(); | 32 virtual ~MediaStreamInfoBar(); |
33 | 33 |
34 // InfoBarView: | 34 // InfoBarView: |
35 virtual void Layout() OVERRIDE; | 35 virtual void Layout() OVERRIDE; |
36 virtual void ViewHierarchyChanged(bool is_add, | 36 virtual void ViewHierarchyChanged(bool is_add, |
37 View* parent, | 37 views::View* parent, |
38 View* child) OVERRIDE; | 38 views::View* child) OVERRIDE; |
39 virtual void ButtonPressed(views::Button* sender, | 39 virtual void ButtonPressed(views::Button* sender, |
40 const views::Event& event) OVERRIDE; | 40 const views::Event& event) OVERRIDE; |
41 virtual int ContentMinimumWidth() const OVERRIDE; | 41 virtual int ContentMinimumWidth() const OVERRIDE; |
42 | 42 |
43 // views::MenuButtonDelegate: | 43 // views::MenuButtonListener: |
44 virtual void RunMenu(View* source, const gfx::Point& pt) OVERRIDE; | 44 virtual void OnMenuButtonClicked(views::View* source, |
| 45 const gfx::Point& point) OVERRIDE; |
45 | 46 |
46 MediaStreamInfoBarDelegate* delegate_; | 47 MediaStreamInfoBarDelegate* delegate_; |
47 | 48 |
48 views::Label* label_; | 49 views::Label* label_; |
49 views::TextButton* allow_button_; | 50 views::TextButton* allow_button_; |
50 views::TextButton* deny_button_; | 51 views::TextButton* deny_button_; |
51 views::MenuButton* devices_menu_button_; | 52 views::MenuButton* devices_menu_button_; |
52 | 53 |
53 MediaStreamDevicesMenuModel devices_menu_model_; | 54 MediaStreamDevicesMenuModel devices_menu_model_; |
54 | 55 |
55 DISALLOW_COPY_AND_ASSIGN(MediaStreamInfoBar); | 56 DISALLOW_COPY_AND_ASSIGN(MediaStreamInfoBar); |
56 }; | 57 }; |
57 | 58 |
58 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_MEDIA_STREAM_INFOBAR_H_ | 59 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_MEDIA_STREAM_INFOBAR_H_ |
OLD | NEW |