summaryrefslogtreecommitdiffstats
path: root/chrome/browser/geolocation
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-06-28 21:49:31 +0100
committerKristian Monsen <kristianm@google.com>2011-07-08 17:55:00 +0100
commitddb351dbec246cf1fab5ec20d2d5520909041de1 (patch)
tree158e3fb57bdcac07c7f1e767fde3c70687c9fbb1 /chrome/browser/geolocation
parent6b92e04f5f151c896e3088e86f70db7081009308 (diff)
downloadexternal_chromium-ddb351dbec246cf1fab5ec20d2d5520909041de1.zip
external_chromium-ddb351dbec246cf1fab5ec20d2d5520909041de1.tar.gz
external_chromium-ddb351dbec246cf1fab5ec20d2d5520909041de1.tar.bz2
Merge Chromium at r12.0.742.93: Initial merge by git
Change-Id: Ic5ee2fec31358bbee305f7e915442377bfa6cda6
Diffstat (limited to 'chrome/browser/geolocation')
-rw-r--r--chrome/browser/geolocation/access_token_store.cc9
-rw-r--r--chrome/browser/geolocation/geolocation_browsertest.cc14
-rw-r--r--chrome/browser/geolocation/geolocation_content_settings_map.cc14
-rw-r--r--chrome/browser/geolocation/geolocation_content_settings_map.h8
-rw-r--r--chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc31
-rw-r--r--chrome/browser/geolocation/geolocation_permission_context.cc22
-rw-r--r--chrome/browser/geolocation/geolocation_permission_context_unittest.cc18
7 files changed, 59 insertions, 57 deletions
diff --git a/chrome/browser/geolocation/access_token_store.cc b/chrome/browser/geolocation/access_token_store.cc
index 78de68f..f76bcc5 100644
--- a/chrome/browser/geolocation/access_token_store.cc
+++ b/chrome/browser/geolocation/access_token_store.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +9,7 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/common/pref_names.h"
#include "content/browser/browser_thread.h"
#include "googleurl/src/gurl.h"
@@ -67,9 +68,9 @@ void ChromePrefsAccessTokenStore::DoLoadAccessTokens(
void SetAccessTokenOnUIThread(const GURL& server_url, const string16& token) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DictionaryValue* access_token_dictionary =
- g_browser_process->local_state()->GetMutableDictionary(
- prefs::kGeolocationAccessToken);
+ DictionaryPrefUpdate update(g_browser_process->local_state(),
+ prefs::kGeolocationAccessToken);
+ DictionaryValue* access_token_dictionary = update.Get();
access_token_dictionary->SetWithoutPathExpansion(
server_url.spec(), Value::CreateStringValue(token));
}
diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc
index 4e831c2..cb9534e 100644
--- a/chrome/browser/geolocation/geolocation_browsertest.cc
+++ b/chrome/browser/geolocation/geolocation_browsertest.cc
@@ -6,18 +6,14 @@
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
-#include "chrome/browser/browser_list.h"
#include "chrome/browser/dom_operation_notification_details.h"
#include "chrome/browser/geolocation/geolocation_content_settings_map.h"
#include "chrome/browser/geolocation/geolocation_settings_state.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/chrome_paths.h"
-#include "chrome/common/geoposition.h"
-#include "chrome/common/notification_details.h"
-#include "chrome/common/notification_service.h"
-#include "chrome/common/notification_type.h"
#include "chrome/test/in_process_browser_test.h"
#include "chrome/test/ui_test_utils.h"
#include "content/browser/geolocation/arbitrator_dependency_factories_for_test.h"
@@ -25,6 +21,10 @@
#include "content/browser/geolocation/mock_location_provider.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h"
+#include "content/common/geoposition.h"
+#include "content/common/notification_details.h"
+#include "content/common/notification_service.h"
+#include "content/common/notification_type.h"
#include "net/base/net_util.h"
#include "net/test/test_server.h"
@@ -195,7 +195,7 @@ void NotifyGeoposition(const Geoposition& geoposition) {
// 3. Allowing the infobar does not trigger an error, and allow a geoposition to
// be passed to javascript.
// 4. Permissions persisted in disk are respected.
-// 5. Off the record profiles don't use saved permissions.
+// 5. Incognito profiles don't use saved permissions.
class GeolocationBrowserTest : public InProcessBrowserTest {
public:
GeolocationBrowserTest()
@@ -453,7 +453,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, NoInfobarForOffTheRecord) {
CheckGeoposition(MockLocationProvider::instance_->position_);
// Disables further prompts from this tab.
CheckStringValueFromJavascript("0", "geoSetMaxNavigateCount(0)");
- // Go off the record, and checks no infobar will be created.
+ // Go incognito, and checks no infobar will be created.
ASSERT_TRUE(Initialize(INITIALIZATION_OFFTHERECORD));
AddGeolocationWatch(false);
CheckGeoposition(MockLocationProvider::instance_->position_);
diff --git a/chrome/browser/geolocation/geolocation_content_settings_map.cc b/chrome/browser/geolocation/geolocation_content_settings_map.cc
index ad17257..5239bf2 100644
--- a/chrome/browser/geolocation/geolocation_content_settings_map.cc
+++ b/chrome/browser/geolocation/geolocation_content_settings_map.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -24,12 +24,12 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/notification_service.h"
-#include "chrome/common/notification_source.h"
-#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "content/browser/browser_thread.h"
+#include "content/common/notification_service.h"
+#include "content/common/notification_source.h"
+#include "content/common/notification_type.h"
#include "net/base/dns_util.h"
#include "net/base/static_cookie_policy.h"
@@ -159,11 +159,9 @@ void GeolocationContentSettingsMap::SetContentSetting(
if (!profile_)
return;
PrefService* prefs = profile_->GetPrefs();
- DictionaryValue* all_settings_dictionary = prefs->GetMutableDictionary(
- prefs::kGeolocationContentSettings);
- DCHECK(all_settings_dictionary);
- ScopedUserPrefUpdate update(prefs, prefs::kGeolocationContentSettings);
+ DictionaryPrefUpdate update(prefs, prefs::kGeolocationContentSettings);
+ DictionaryValue* all_settings_dictionary = update.Get();
DictionaryValue* requesting_origin_settings_dictionary = NULL;
all_settings_dictionary->GetDictionaryWithoutPathExpansion(
requesting_origin.spec(), &requesting_origin_settings_dictionary);
diff --git a/chrome/browser/geolocation/geolocation_content_settings_map.h b/chrome/browser/geolocation/geolocation_content_settings_map.h
index 74a74fa..a6d189f 100644
--- a/chrome/browser/geolocation/geolocation_content_settings_map.h
+++ b/chrome/browser/geolocation/geolocation_content_settings_map.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,11 +16,11 @@
#include <map>
#include "base/basictypes.h"
-#include "base/ref_counted.h"
+#include "base/memory/ref_counted.h"
#include "chrome/browser/prefs/pref_change_registrar.h"
#include "chrome/common/content_settings.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
+#include "content/common/notification_observer.h"
+#include "content/common/notification_registrar.h"
#include "googleurl/src/gurl.h"
class ContentSettingsDetails;
diff --git a/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc b/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc
index ea677a9..c5514ce 100644
--- a/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc
+++ b/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,11 +6,12 @@
#include "chrome/browser/content_settings/content_settings_details.h"
#include "chrome/browser/geolocation/geolocation_content_settings_map.h"
#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/common/notification_registrar.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/testing_profile.h"
#include "content/browser/browser_thread.h"
+#include "content/common/notification_registrar.h"
+#include "content/common/notification_service.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -247,17 +248,19 @@ TEST_F(GeolocationContentSettingsMapTests, WildCardForEmptyEmbedder) {
TEST_F(GeolocationContentSettingsMapTests, IgnoreInvalidURLsInPrefs) {
TestingProfile profile;
- DictionaryValue* all_settings_dictionary =
- profile.GetPrefs()->GetMutableDictionary(
- prefs::kGeolocationContentSettings);
- // For simplicity, use the overloads that do path expansion. As '.' is the
- // path separator, we can't have dotted hostnames (which is fine).
- all_settings_dictionary->SetInteger("http://a/.http://b/",
- CONTENT_SETTING_ALLOW);
- all_settings_dictionary->SetInteger("bad_requester.http://b/",
- CONTENT_SETTING_ALLOW);
- all_settings_dictionary->SetInteger("http://a/.bad-embedder",
- CONTENT_SETTING_ALLOW);
+ {
+ DictionaryPrefUpdate update(profile.GetPrefs(),
+ prefs::kGeolocationContentSettings);
+ DictionaryValue* all_settings_dictionary = update.Get();
+ // For simplicity, use the overloads that do path expansion. As '.' is the
+ // path separator, we can't have dotted hostnames (which is fine).
+ all_settings_dictionary->SetInteger("http://a/.http://b/",
+ CONTENT_SETTING_ALLOW);
+ all_settings_dictionary->SetInteger("bad_requester.http://b/",
+ CONTENT_SETTING_ALLOW);
+ all_settings_dictionary->SetInteger("http://a/.bad-embedder",
+ CONTENT_SETTING_ALLOW);
+ }
GeolocationContentSettingsMap* map =
profile.GetGeolocationContentSettingsMap();
diff --git a/chrome/browser/geolocation/geolocation_permission_context.cc b/chrome/browser/geolocation/geolocation_permission_context.cc
index d98841f..f9ce488 100644
--- a/chrome/browser/geolocation/geolocation_permission_context.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context.cc
@@ -17,16 +17,16 @@
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/common/extensions/extension.h"
-#include "chrome/common/notification_registrar.h"
-#include "chrome/common/notification_source.h"
-#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/render_messages.h"
#include "content/browser/browser_thread.h"
#include "content/browser/geolocation/geolocation_provider.h"
#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h"
+#include "content/common/geolocation_messages.h"
+#include "content/common/notification_registrar.h"
+#include "content/common/notification_source.h"
+#include "content/common/notification_type.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "grit/theme_resources.h"
@@ -214,9 +214,9 @@ bool GeolocationConfirmInfoBarDelegate::LinkClicked(
WindowOpenDisposition disposition) {
const char kGeolocationLearnMoreUrl[] =
#if defined(OS_CHROMEOS)
- "http://www.google.com/support/chromeos/bin/answer.py?answer=142065";
+ "https://www.google.com/support/chromeos/bin/answer.py?answer=142065";
#else
- "http://www.google.com/support/chrome/bin/answer.py?answer=142065";
+ "https://www.google.com/support/chrome/bin/answer.py?answer=142065";
#endif
// Ignore the click disposition and always open in a new top level tab.
@@ -236,8 +236,8 @@ struct GeolocationInfoBarQueueController::PendingInfoBarRequest {
PendingInfoBarRequest(int render_process_id,
int render_view_id,
int bridge_id,
- GURL requesting_frame,
- GURL embedder);
+ const GURL& requesting_frame,
+ const GURL& embedder);
bool IsForTab(int p_render_process_id, int p_render_view_id) const;
bool IsForPair(const GURL& p_requesting_frame,
@@ -258,8 +258,8 @@ GeolocationInfoBarQueueController::PendingInfoBarRequest::PendingInfoBarRequest(
int render_process_id,
int render_view_id,
int bridge_id,
- GURL requesting_frame,
- GURL embedder)
+ const GURL& requesting_frame,
+ const GURL& embedder)
: render_process_id(render_process_id),
render_view_id(render_view_id),
bridge_id(bridge_id),
@@ -596,7 +596,7 @@ void GeolocationPermissionContext::NotifyPermissionSet(
RenderViewHost* r = RenderViewHost::FromID(render_process_id, render_view_id);
if (r) {
- r->Send(new ViewMsg_Geolocation_PermissionSet(
+ r->Send(new GeolocationMsg_PermissionSet(
render_view_id, bridge_id, allowed));
}
diff --git a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
index d96cb7f..bb31fdf 100644
--- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
@@ -2,12 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/scoped_vector.h"
+#include "base/memory/scoped_vector.h"
#include "chrome/browser/geolocation/geolocation_content_settings_map.h"
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
-#include "chrome/common/notification_details.h"
-#include "chrome/common/notification_type.h"
-#include "chrome/common/render_messages.h"
#include "chrome/test/testing_profile.h"
#include "content/browser/browser_thread.h"
#include "content/browser/geolocation/arbitrator_dependency_factories_for_test.h"
@@ -18,6 +15,9 @@
#include "content/browser/renderer_host/mock_render_process_host.h"
#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/tab_contents/test_tab_contents.h"
+#include "content/common/geolocation_messages.h"
+#include "content/common/notification_details.h"
+#include "content/common/notification_type.h"
#include "testing/gtest/include/gtest/gtest.h"
// TestTabContentsWithPendingInfoBar ------------------------------------------
@@ -138,10 +138,10 @@ void GeolocationPermissionContextTests::CheckPermissionMessageSentInternal(
MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
MessageLoop::current()->Run();
const IPC::Message* message = process->sink().GetFirstMessageMatching(
- ViewMsg_Geolocation_PermissionSet::ID);
+ GeolocationMsg_PermissionSet::ID);
ASSERT_TRUE(message);
- ViewMsg_Geolocation_PermissionSet::Param param;
- ViewMsg_Geolocation_PermissionSet::Read(message, &param);
+ GeolocationMsg_PermissionSet::Param param;
+ GeolocationMsg_PermissionSet::Read(message, &param);
EXPECT_EQ(bridge_id, param.a);
EXPECT_EQ(allowed, param.b);
process->sink().ClearMessages();
@@ -176,10 +176,10 @@ void GeolocationPermissionContextTests::SetUp() {
RenderViewHostTestHarness::SetUp();
GeolocationArbitrator::SetDependencyFactoryForTest(
dependency_factory_.get());
- SiteInstance* site_instance = contents_->GetSiteInstance();
+ SiteInstance* site_instance = contents()->GetSiteInstance();
tab_contents_with_pending_infobar_ =
new TestTabContentsWithPendingInfoBar(profile_.get(), site_instance);
- contents_.reset(tab_contents_with_pending_infobar_);
+ SetContents(tab_contents_with_pending_infobar_);
geolocation_permission_context_ =
new GeolocationPermissionContext(profile());
}