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 "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "chrome/browser/content_settings/permission_queue_controller.h" | 8 #include "chrome/browser/content_settings/permission_queue_controller.h" |
9 #include "chrome/browser/google/google_util.h" | 9 #include "chrome/browser/google/google_util.h" |
10 #include "chrome/browser/infobars/infobar.h" | 10 #include "chrome/browser/infobars/infobar.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 } | 60 } |
61 | 61 |
62 } // namespace | 62 } // namespace |
63 | 63 |
64 // static | 64 // static |
65 InfoBar* GeolocationInfoBarDelegate::Create( | 65 InfoBar* GeolocationInfoBarDelegate::Create( |
66 InfoBarService* infobar_service, | 66 InfoBarService* infobar_service, |
67 PermissionQueueController* controller, | 67 PermissionQueueController* controller, |
68 const PermissionRequestID& id, | 68 const PermissionRequestID& id, |
69 const GURL& requesting_frame, | 69 const GURL& requesting_frame, |
70 const std::string& display_languages) { | 70 const std::string& display_languages, |
71 const std::string accept_button_label) { | |
71 RecordUmaEvent(GEOLOCATION_INFO_BAR_DELEGATE_EVENT_CREATE); | 72 RecordUmaEvent(GEOLOCATION_INFO_BAR_DELEGATE_EVENT_CREATE); |
72 const content::NavigationEntry* committed_entry = | 73 const content::NavigationEntry* committed_entry = |
73 infobar_service->web_contents()->GetController().GetLastCommittedEntry(); | 74 infobar_service->web_contents()->GetController().GetLastCommittedEntry(); |
74 return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 75 GeolocationInfoBarDelegate* const delegate = new DelegateType( |
bulach
2014/02/14 11:36:48
nit: is it possible to keep everything inline?
re
acleung1
2014/02/21 21:18:01
My thoughts were that it was a bit too long as one
| |
75 scoped_ptr<ConfirmInfoBarDelegate>(new DelegateType( | |
76 controller, id, requesting_frame, | 76 controller, id, requesting_frame, |
77 committed_entry ? committed_entry->GetUniqueID() : 0, | 77 committed_entry ? committed_entry->GetUniqueID() : 0, |
78 display_languages)))); | 78 display_languages, accept_button_label); |
79 | |
80 InfoBar* infobar = ConfirmInfoBarDelegate::CreateInfoBar( | |
81 scoped_ptr<ConfirmInfoBarDelegate>(delegate)).release(); | |
82 return infobar_service->AddInfoBar(scoped_ptr<InfoBar>(infobar)); | |
79 } | 83 } |
80 | 84 |
81 GeolocationInfoBarDelegate::GeolocationInfoBarDelegate( | 85 GeolocationInfoBarDelegate::GeolocationInfoBarDelegate( |
82 PermissionQueueController* controller, | 86 PermissionQueueController* controller, |
83 const PermissionRequestID& id, | 87 const PermissionRequestID& id, |
84 const GURL& requesting_frame, | 88 const GURL& requesting_frame, |
85 int contents_unique_id, | 89 int contents_unique_id, |
86 const std::string& display_languages) | 90 const std::string& display_languages) |
87 : ConfirmInfoBarDelegate(), | 91 : ConfirmInfoBarDelegate(), |
88 controller_(controller), | 92 controller_(controller), |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
172 "https://www.google.com/support/chrome/bin/answer.py?answer=142065"; | 176 "https://www.google.com/support/chrome/bin/answer.py?answer=142065"; |
173 #endif | 177 #endif |
174 | 178 |
175 web_contents()->OpenURL(content::OpenURLParams( | 179 web_contents()->OpenURL(content::OpenURLParams( |
176 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), | 180 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), |
177 content::Referrer(), | 181 content::Referrer(), |
178 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 182 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
179 content::PAGE_TRANSITION_LINK, false)); | 183 content::PAGE_TRANSITION_LINK, false)); |
180 return false; // Do not dismiss the info bar. | 184 return false; // Do not dismiss the info bar. |
181 } | 185 } |
OLD | NEW |