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_GEOLOCATION_GEOLOCATION_CONFIRM_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_CONFIRM_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_INFOBAR_DELEGATE_H_ |
7 | 7 |
8 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | |
9 #include "chrome/browser/geolocation/geolocation_permission_request_id.h" | 8 #include "chrome/browser/geolocation/geolocation_permission_request_id.h" |
| 9 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 class GeolocationInfoBarQueueController; | 14 class GeolocationInfoBarQueueController; |
15 class InfoBarService; | 15 class InfoBarService; |
16 | 16 |
17 // GeolocationInfoBarDelegates are created by the | 17 // GeolocationInfoBarDelegates are created by the |
18 // GeolocationInfoBarQueueController to control the display | 18 // GeolocationInfoBarQueueController to control the display |
19 // and handling of geolocation permission infobars to the user. | 19 // and handling of geolocation permission infobars to the user. |
20 class GeolocationConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { | 20 class GeolocationInfoBarDelegate : public ConfirmInfoBarDelegate { |
21 public: | 21 public: |
22 // Creates a geolocation delegate and adds it to |infobar_service|. Returns | 22 // Creates a geolocation delegate and adds it to |infobar_service|. Returns |
23 // the delegate if it was successfully added. | 23 // the delegate if it was successfully added. |
24 static InfoBarDelegate* Create(InfoBarService* infobar_service, | 24 static InfoBarDelegate* Create(InfoBarService* infobar_service, |
25 GeolocationInfoBarQueueController* controller, | 25 GeolocationInfoBarQueueController* controller, |
26 const GeolocationPermissionRequestID& id, | 26 const GeolocationPermissionRequestID& id, |
27 const GURL& requesting_frame, | 27 const GURL& requesting_frame, |
28 const std::string& display_languages); | 28 const std::string& display_languages); |
29 | 29 |
30 protected: | 30 protected: |
31 GeolocationConfirmInfoBarDelegate( | 31 GeolocationInfoBarDelegate(InfoBarService* infobar_service, |
32 InfoBarService* infobar_service, | 32 GeolocationInfoBarQueueController* controller, |
33 GeolocationInfoBarQueueController* controller, | 33 const GeolocationPermissionRequestID& id, |
34 const GeolocationPermissionRequestID& id, | 34 const GURL& requesting_frame, |
35 const GURL& requesting_frame, | 35 const std::string& display_languages); |
36 const std::string& display_languages); | |
37 | 36 |
38 const GeolocationPermissionRequestID& id() const { return id_; } | 37 const GeolocationPermissionRequestID& id() const { return id_; } |
39 | 38 |
40 // ConfirmInfoBarDelegate: | 39 // ConfirmInfoBarDelegate: |
41 virtual gfx::Image* GetIcon() const OVERRIDE; | 40 virtual gfx::Image* GetIcon() const OVERRIDE; |
42 virtual Type GetInfoBarType() const OVERRIDE; | 41 virtual Type GetInfoBarType() const OVERRIDE; |
43 virtual bool ShouldExpireInternal( | 42 virtual bool ShouldExpireInternal( |
44 const content::LoadCommittedDetails& details) const OVERRIDE; | 43 const content::LoadCommittedDetails& details) const OVERRIDE; |
45 virtual string16 GetMessageText() const OVERRIDE; | 44 virtual string16 GetMessageText() const OVERRIDE; |
46 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 45 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
47 virtual bool Accept() OVERRIDE; | 46 virtual bool Accept() OVERRIDE; |
48 virtual bool Cancel() OVERRIDE; | 47 virtual bool Cancel() OVERRIDE; |
49 virtual string16 GetLinkText() const OVERRIDE; | 48 virtual string16 GetLinkText() const OVERRIDE; |
50 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; | 49 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; |
51 | 50 |
52 // Call back to the controller, to inform of the user's decision. | 51 // Call back to the controller, to inform of the user's decision. |
53 void SetPermission(bool update_content_setting, bool allowed); | 52 void SetPermission(bool update_content_setting, bool allowed); |
54 | 53 |
55 private: | 54 private: |
56 GeolocationInfoBarQueueController* controller_; | 55 GeolocationInfoBarQueueController* controller_; |
57 const GeolocationPermissionRequestID id_; | 56 const GeolocationPermissionRequestID id_; |
58 GURL requesting_frame_; | 57 GURL requesting_frame_; |
59 int contents_unique_id_; | 58 int contents_unique_id_; |
60 std::string display_languages_; | 59 std::string display_languages_; |
61 | 60 |
62 DISALLOW_IMPLICIT_CONSTRUCTORS(GeolocationConfirmInfoBarDelegate); | 61 DISALLOW_IMPLICIT_CONSTRUCTORS(GeolocationInfoBarDelegate); |
63 }; | 62 }; |
64 | 63 |
65 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_CONFIRM_INFOBAR_DELEGATE_H_ | 64 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_INFOBAR_DELEGATE_H_ |
OLD | NEW |