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