OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "base/waitable_event.h" | 7 #include "base/waitable_event.h" |
8 #include "chrome/browser/app_modal_dialog.h" | 8 #include "chrome/browser/app_modal_dialog.h" |
9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
10 #include "chrome/browser/browser_list.h" | 10 #include "chrome/browser/browser_list.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // Checks we have no error. | 271 // Checks we have no error. |
272 CheckStringValueFromJavascript("0", "geoGetLastError()"); | 272 CheckStringValueFromJavascript("0", "geoGetLastError()"); |
273 CheckStringValueFromJavascript( | 273 CheckStringValueFromJavascript( |
274 DoubleToString(geoposition.latitude), "geoGetLastPositionLatitude()"); | 274 DoubleToString(geoposition.latitude), "geoGetLastPositionLatitude()"); |
275 CheckStringValueFromJavascript( | 275 CheckStringValueFromJavascript( |
276 DoubleToString(geoposition.longitude), "geoGetLastPositionLongitude()"); | 276 DoubleToString(geoposition.longitude), "geoGetLastPositionLongitude()"); |
277 } | 277 } |
278 | 278 |
279 void SetInfobarResponse(const GURL& requesting_url, bool allowed) { | 279 void SetInfobarResponse(const GURL& requesting_url, bool allowed) { |
280 TabContents* tab_contents = current_browser_->GetSelectedTabContents(); | 280 TabContents* tab_contents = current_browser_->GetSelectedTabContents(); |
| 281 TabSpecificContentSettings* content_settings = |
| 282 tab_contents->GetTabSpecificContentSettings(); |
281 const GeolocationSettingsState& settings_state = | 283 const GeolocationSettingsState& settings_state = |
282 tab_contents->geolocation_settings_state(); | 284 content_settings->geolocation_settings_state(); |
283 size_t state_map_size = settings_state.state_map().size(); | 285 size_t state_map_size = settings_state.state_map().size(); |
284 ASSERT_TRUE(infobar_); | 286 ASSERT_TRUE(infobar_); |
285 LOG(WARNING) << "will set infobar response"; | 287 LOG(WARNING) << "will set infobar response"; |
286 if (allowed) | 288 if (allowed) |
287 infobar_->AsConfirmInfoBarDelegate()->Accept(); | 289 infobar_->AsConfirmInfoBarDelegate()->Accept(); |
288 else | 290 else |
289 infobar_->AsConfirmInfoBarDelegate()->Cancel(); | 291 infobar_->AsConfirmInfoBarDelegate()->Cancel(); |
290 WaitForJSPrompt(); | 292 WaitForJSPrompt(); |
291 tab_contents->RemoveInfoBar(infobar_); | 293 tab_contents->RemoveInfoBar(infobar_); |
292 LOG(WARNING) << "infobar response set"; | 294 LOG(WARNING) << "infobar response set"; |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 SetInfobarResponse(current_url_, true); | 575 SetInfobarResponse(current_url_, true); |
574 CheckGeoposition(MockLocationProvider::instance_->position_); | 576 CheckGeoposition(MockLocationProvider::instance_->position_); |
575 | 577 |
576 // The second watch will now have cancelled. Ensure an update still makes | 578 // The second watch will now have cancelled. Ensure an update still makes |
577 // its way through to the first watcher. | 579 // its way through to the first watcher. |
578 ChromeThread::PostTask(ChromeThread::IO, FROM_HERE, NewRunnableFunction( | 580 ChromeThread::PostTask(ChromeThread::IO, FROM_HERE, NewRunnableFunction( |
579 &NotifyGeopositionOnIOThread, final_position)); | 581 &NotifyGeopositionOnIOThread, final_position)); |
580 WaitForJSPrompt(); | 582 WaitForJSPrompt(); |
581 CheckGeoposition(final_position); | 583 CheckGeoposition(final_position); |
582 } | 584 } |
OLD | NEW |