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

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: address comments / fix tests Created 6 years, 9 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 "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
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(
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,
91 const std::string& accept_button_label)
87 : ConfirmInfoBarDelegate(), 92 : ConfirmInfoBarDelegate(),
88 controller_(controller), 93 controller_(controller),
89 id_(id), 94 id_(id),
90 requesting_frame_(requesting_frame.GetOrigin()), 95 requesting_frame_(requesting_frame.GetOrigin()),
91 contents_unique_id_(contents_unique_id), 96 contents_unique_id_(contents_unique_id),
92 display_languages_(display_languages), 97 display_languages_(display_languages),
93 user_has_interacted_(false) { 98 user_has_interacted_(false) {
94 } 99 }
95 100
96 GeolocationInfoBarDelegate::~GeolocationInfoBarDelegate() { 101 GeolocationInfoBarDelegate::~GeolocationInfoBarDelegate() {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 "https://www.google.com/support/chrome/bin/answer.py?answer=142065"; 177 "https://www.google.com/support/chrome/bin/answer.py?answer=142065";
173 #endif 178 #endif
174 179
175 web_contents()->OpenURL(content::OpenURLParams( 180 web_contents()->OpenURL(content::OpenURLParams(
176 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), 181 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)),
177 content::Referrer(), 182 content::Referrer(),
178 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 183 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
179 content::PAGE_TRANSITION_LINK, false)); 184 content::PAGE_TRANSITION_LINK, false));
180 return false; // Do not dismiss the info bar. 185 return false; // Do not dismiss the info bar.
181 } 186 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698