| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_CONFIRM_INFOBAR_DELEGATE_H_ | |
| 6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_CONFIRM_INFOBAR_DELEGATE_H_ | |
| 7 | |
| 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" | |
| 11 | |
| 12 #include <string> | |
| 13 | |
| 14 class GeolocationInfoBarQueueController; | |
| 15 class InfoBarService; | |
| 16 | |
| 17 // GeolocationInfoBarDelegates are created by the | |
| 18 // GeolocationInfoBarQueueController to control the display | |
| 19 // and handling of geolocation permission infobars to the user. | |
| 20 class GeolocationConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { | |
| 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: | |
| 31 GeolocationConfirmInfoBarDelegate( | |
| 32 InfoBarService* infobar_service, | |
| 33 GeolocationInfoBarQueueController* controller, | |
| 34 const GeolocationPermissionRequestID& id, | |
| 35 const GURL& requesting_frame, | |
| 36 const std::string& display_languages); | |
| 37 | |
| 38 const GeolocationPermissionRequestID& id() const { return id_; } | |
| 39 | |
| 40 // ConfirmInfoBarDelegate: | |
| 41 virtual gfx::Image* GetIcon() const OVERRIDE; | |
| 42 virtual Type GetInfoBarType() const OVERRIDE; | |
| 43 virtual bool ShouldExpireInternal( | |
| 44 const content::LoadCommittedDetails& details) const OVERRIDE; | |
| 45 virtual string16 GetMessageText() const OVERRIDE; | |
| 46 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | |
| 47 virtual bool Accept() OVERRIDE; | |
| 48 virtual bool Cancel() OVERRIDE; | |
| 49 virtual string16 GetLinkText() const OVERRIDE; | |
| 50 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; | |
| 51 | |
| 52 // Call back to the controller, to inform of the user's decision. | |
| 53 void SetPermission(bool update_content_setting, bool allowed); | |
| 54 | |
| 55 private: | |
| 56 GeolocationInfoBarQueueController* controller_; | |
| 57 const GeolocationPermissionRequestID id_; | |
| 58 GURL requesting_frame_; | |
| 59 int contents_unique_id_; | |
| 60 std::string display_languages_; | |
| 61 | |
| 62 DISALLOW_IMPLICIT_CONSTRUCTORS(GeolocationConfirmInfoBarDelegate); | |
| 63 }; | |
| 64 | |
| 65 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_CONFIRM_INFOBAR_DELEGATE_H_ | |
| OLD | NEW |