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 #include "chrome/browser/geolocation/geolocation_infobar_delegate.h" | 5 #include "chrome/browser/geolocation/geolocation_infobar_delegate.h" |
6 | 6 |
7 #include "chrome/browser/content_settings/permission_queue_controller.h" | 7 #include "chrome/browser/content_settings/permission_queue_controller.h" |
8 #include "chrome/browser/google/google_util.h" | 8 #include "chrome/browser/google/google_util.h" |
9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
10 #include "content/public/browser/navigation_details.h" | 10 #include "content/public/browser/navigation_details.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 GeolocationInfoBarDelegate::GeolocationInfoBarDelegate( | 42 GeolocationInfoBarDelegate::GeolocationInfoBarDelegate( |
43 InfoBarService* infobar_service, | 43 InfoBarService* infobar_service, |
44 PermissionQueueController* controller, | 44 PermissionQueueController* controller, |
45 const PermissionRequestID& id, | 45 const PermissionRequestID& id, |
46 const GURL& requesting_frame, | 46 const GURL& requesting_frame, |
47 int contents_unique_id, | 47 int contents_unique_id, |
48 const std::string& display_languages) | 48 const std::string& display_languages) |
49 : ConfirmInfoBarDelegate(infobar_service), | 49 : ConfirmInfoBarDelegate(infobar_service), |
50 controller_(controller), | 50 controller_(controller), |
51 id_(id), | 51 id_(id), |
52 requesting_frame_(requesting_frame), | 52 requesting_frame_(requesting_frame), |
joth
2013/09/12 17:12:34
(OT for this patch)
should this be requesting_fra
Michael van Ouwerkerk
2013/09/13 13:41:26
Done.
| |
53 contents_unique_id_(contents_unique_id), | 53 contents_unique_id_(contents_unique_id), |
54 display_languages_(display_languages) { | 54 display_languages_(display_languages) { |
55 } | 55 } |
56 | 56 |
57 GeolocationInfoBarDelegate::~GeolocationInfoBarDelegate() { | 57 GeolocationInfoBarDelegate::~GeolocationInfoBarDelegate() { |
58 } | 58 } |
59 | 59 |
60 bool GeolocationInfoBarDelegate::Accept() { | 60 bool GeolocationInfoBarDelegate::Accept() { |
61 SetPermission(true, true); | 61 SetPermission(true, true); |
62 return true; | 62 return true; |
63 } | 63 } |
64 | 64 |
65 void GeolocationInfoBarDelegate::SetPermission(bool update_content_setting, | 65 void GeolocationInfoBarDelegate::SetPermission(bool update_content_setting, |
66 bool allowed) { | 66 bool allowed) { |
67 if (web_contents()) { | 67 if (web_contents()) { |
68 controller_->OnPermissionSet(id_, requesting_frame_, | 68 GURL embedder = web_contents()->GetLastCommittedURL().GetOrigin(); |
69 web_contents()->GetURL(), | 69 controller_->OnPermissionSet(id_, requesting_frame_, embedder, |
70 update_content_setting, allowed); | 70 update_content_setting, allowed); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 void GeolocationInfoBarDelegate::InfoBarDismissed() { | 74 void GeolocationInfoBarDelegate::InfoBarDismissed() { |
75 SetPermission(false, false); | 75 SetPermission(false, false); |
76 } | 76 } |
77 | 77 |
78 int GeolocationInfoBarDelegate::GetIconID() const { | 78 int GeolocationInfoBarDelegate::GetIconID() const { |
79 return IDR_GEOLOCATION_INFOBAR_ICON; | 79 return IDR_GEOLOCATION_INFOBAR_ICON; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 "https://www.google.com/support/chrome/bin/answer.py?answer=142065"; | 123 "https://www.google.com/support/chrome/bin/answer.py?answer=142065"; |
124 #endif | 124 #endif |
125 | 125 |
126 web_contents()->OpenURL(content::OpenURLParams( | 126 web_contents()->OpenURL(content::OpenURLParams( |
127 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), | 127 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), |
128 content::Referrer(), | 128 content::Referrer(), |
129 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 129 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
130 content::PAGE_TRANSITION_LINK, false)); | 130 content::PAGE_TRANSITION_LINK, false)); |
131 return false; // Do not dismiss the info bar. | 131 return false; // Do not dismiss the info bar. |
132 } | 132 } |
OLD | NEW |