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 15 matching lines...) Expand all Loading... |
26 | 26 |
27 // static | 27 // static |
28 InfoBarDelegate* GeolocationInfoBarDelegate::Create( | 28 InfoBarDelegate* GeolocationInfoBarDelegate::Create( |
29 InfoBarService* infobar_service, | 29 InfoBarService* infobar_service, |
30 PermissionQueueController* controller, | 30 PermissionQueueController* controller, |
31 const PermissionRequestID& id, | 31 const PermissionRequestID& id, |
32 const GURL& requesting_frame, | 32 const GURL& requesting_frame, |
33 const std::string& display_languages) { | 33 const std::string& display_languages) { |
34 const content::NavigationEntry* committed_entry = | 34 const content::NavigationEntry* committed_entry = |
35 infobar_service->web_contents()->GetController().GetLastCommittedEntry(); | 35 infobar_service->web_contents()->GetController().GetLastCommittedEntry(); |
36 return infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( | 36 GeolocationInfoBarDelegate* const delegate = |
37 new DelegateType(infobar_service, controller, id, requesting_frame, | 37 new DelegateType(infobar_service, controller, id, requesting_frame, |
38 committed_entry ? committed_entry->GetUniqueID() : 0, | 38 committed_entry ? committed_entry->GetUniqueID() : 0, |
39 display_languages))); | 39 display_languages); |
| 40 delegate->Show(infobar_service); |
| 41 return delegate; |
| 42 } |
| 43 |
| 44 void GeolocationInfoBarDelegate::Show(InfoBarService* infobar_service) { |
| 45 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(this)); |
40 } | 46 } |
41 | 47 |
42 GeolocationInfoBarDelegate::GeolocationInfoBarDelegate( | 48 GeolocationInfoBarDelegate::GeolocationInfoBarDelegate( |
43 InfoBarService* infobar_service, | 49 InfoBarService* infobar_service, |
44 PermissionQueueController* controller, | 50 PermissionQueueController* controller, |
45 const PermissionRequestID& id, | 51 const PermissionRequestID& id, |
46 const GURL& requesting_frame, | 52 const GURL& requesting_frame, |
47 int contents_unique_id, | 53 int contents_unique_id, |
48 const std::string& display_languages) | 54 const std::string& display_languages) |
49 : ConfirmInfoBarDelegate(infobar_service), | 55 : ConfirmInfoBarDelegate(infobar_service), |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 "https://www.google.com/support/chrome/bin/answer.py?answer=142065"; | 127 "https://www.google.com/support/chrome/bin/answer.py?answer=142065"; |
122 #endif | 128 #endif |
123 | 129 |
124 web_contents()->OpenURL(content::OpenURLParams( | 130 web_contents()->OpenURL(content::OpenURLParams( |
125 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), | 131 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), |
126 content::Referrer(), | 132 content::Referrer(), |
127 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 133 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
128 content::PAGE_TRANSITION_LINK, false)); | 134 content::PAGE_TRANSITION_LINK, false)); |
129 return false; // Do not dismiss the info bar. | 135 return false; // Do not dismiss the info bar. |
130 } | 136 } |
OLD | NEW |