Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: chrome/browser/geolocation/geolocation_infobar_delegate.cc

Issue 23345004: Fix Android strict-mode violation in GeoLocation info bar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ups Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 DelegateType * const delegate =
Miguel Garcia 2013/08/21 11:46:46 nit: DelegateType* (no space)
acleung1 2013/08/23 23:13:09 Done.
37 new DelegateType(infobar_service, controller, id, requesting_frame, 37 new DelegateType(infobar_service, controller, id, requesting_frame,
Miguel Garcia 2013/08/21 11:46:46 I thin you can push the Initialize/Show thing to t
acleung1 2013/08/23 23:13:09 It difficult to have a sort of polymorphic behavio
38 committed_entry ? committed_entry->GetUniqueID() : 0, 38 committed_entry ? committed_entry->GetUniqueID() : 0,
39 display_languages))); 39 display_languages);
40 delegate->Initialize(infobar_service);
41 return delegate;
42 }
43
44 void GeolocationInfoBarDelegate::Initialize(InfoBarService* infobar_service) {
45 this->Show(infobar_service);
46 }
47
48 void GeolocationInfoBarDelegate::Show(InfoBarService* infobar_service) {
49 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(this));
40 } 50 }
41 51
42 GeolocationInfoBarDelegate::GeolocationInfoBarDelegate( 52 GeolocationInfoBarDelegate::GeolocationInfoBarDelegate(
43 InfoBarService* infobar_service, 53 InfoBarService* infobar_service,
44 PermissionQueueController* controller, 54 PermissionQueueController* controller,
45 const PermissionRequestID& id, 55 const PermissionRequestID& id,
46 const GURL& requesting_frame, 56 const GURL& requesting_frame,
47 int contents_unique_id, 57 int contents_unique_id,
48 const std::string& display_languages) 58 const std::string& display_languages)
49 : ConfirmInfoBarDelegate(infobar_service), 59 : ConfirmInfoBarDelegate(infobar_service),
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 "https://www.google.com/support/chrome/bin/answer.py?answer=142065"; 127 "https://www.google.com/support/chrome/bin/answer.py?answer=142065";
118 #endif 128 #endif
119 129
120 web_contents()->OpenURL(content::OpenURLParams( 130 web_contents()->OpenURL(content::OpenURLParams(
121 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), 131 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)),
122 content::Referrer(), 132 content::Referrer(),
123 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 133 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
124 content::PAGE_TRANSITION_LINK, false)); 134 content::PAGE_TRANSITION_LINK, false));
125 return false; // Do not dismiss the info bar. 135 return false; // Do not dismiss the info bar.
126 } 136 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698