Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / geolocation / geolocation_infobar_delegate.cc
index 0ffb663..d692cea 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 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.
 
 #include "net/base/net_util.h"
 #include "ui/base/l10n/l10n_util.h"
 
-#if defined(OS_ANDROID)
-#include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h"
-typedef GeolocationInfoBarDelegateAndroid DelegateType;
-#else
-typedef GeolocationInfoBarDelegate DelegateType;
-#endif
 
 namespace {
 
@@ -45,7 +39,7 @@ enum GeolocationInfoBarDelegateEvent {
   GEOLOCATION_INFO_BAR_DELEGATE_EVENT_DISMISS = 3,
 
   // User clicked on link.
-  GEOLOCATION_INFO_BAR_DELEGATE_EVENT_LINK_CLICK = 4,
+  DEPRECATED_GEOLOCATION_INFO_BAR_DELEGATE_EVENT_LINK_CLICK = 4,
 
   // User ignored the bar.
   GEOLOCATION_INFO_BAR_DELEGATE_EVENT_IGNORED = 5,
@@ -67,15 +61,14 @@ infobars::InfoBar* GeolocationInfoBarDelegate::Create(
     PermissionQueueController* controller,
     const PermissionRequestID& id,
     const GURL& requesting_frame,
-    const std::string& display_languages,
-    const std::string& accept_button_label) {
+    const std::string& display_languages) {
   RecordUmaEvent(GEOLOCATION_INFO_BAR_DELEGATE_EVENT_CREATE);
   const content::NavigationEntry* committed_entry =
       infobar_service->web_contents()->GetController().GetLastCommittedEntry();
-  GeolocationInfoBarDelegate* const delegate = new DelegateType(
+  GeolocationInfoBarDelegate* const delegate = new GeolocationInfoBarDelegate(
           controller, id, requesting_frame,
           committed_entry ? committed_entry->GetUniqueID() : 0,
-          display_languages, accept_button_label);
+          display_languages);
 
   infobars::InfoBar* infobar = ConfirmInfoBarDelegate::CreateInfoBar(
       scoped_ptr<ConfirmInfoBarDelegate>(delegate)).release();
@@ -87,8 +80,7 @@ GeolocationInfoBarDelegate::GeolocationInfoBarDelegate(
     const PermissionRequestID& id,
     const GURL& requesting_frame,
     int contents_unique_id,
-    const std::string& display_languages,
-    const std::string& accept_button_label)
+    const std::string& display_languages)
     : ConfirmInfoBarDelegate(),
       controller_(controller),
       id_(id),
@@ -145,7 +137,10 @@ bool GeolocationInfoBarDelegate::ShouldExpireInternal(
 
 base::string16 GeolocationInfoBarDelegate::GetMessageText() const {
   return l10n_util::GetStringFUTF16(IDS_GEOLOCATION_INFOBAR_QUESTION,
-      net::FormatUrl(requesting_frame_, display_languages_));
+      net::FormatUrl(requesting_frame_, display_languages_,
+                     net::kFormatUrlOmitUsernamePassword |
+                     net::kFormatUrlOmitTrailingSlashOnBareHostname,
+                     net::UnescapeRule::SPACES, NULL, NULL, NULL));
 }
 
 base::string16 GeolocationInfoBarDelegate::GetButtonLabel(
@@ -160,28 +155,3 @@ bool GeolocationInfoBarDelegate::Cancel() {
   SetPermission(true, false);
   return true;
 }
-
-base::string16 GeolocationInfoBarDelegate::GetLinkText() const {
-  return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
-}
-
-bool GeolocationInfoBarDelegate::LinkClicked(
-    WindowOpenDisposition disposition) {
-  RecordUmaEvent(GEOLOCATION_INFO_BAR_DELEGATE_EVENT_LINK_CLICK);
-  const char kGeolocationLearnMoreUrl[] =
-#if defined(OS_CHROMEOS)
-      "https://www.google.com/support/chromeos/bin/answer.py?answer=142065";
-#elif defined(OS_ANDROID)
-      "https://support.google.com/chrome/?p=mobile_location";
-#else
-      "https://www.google.com/support/chrome/bin/answer.py?answer=142065";
-#endif
-
-  InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL(
-      content::OpenURLParams(
-          GURL(kGeolocationLearnMoreUrl),
-          content::Referrer(),
-          (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
-          content::PAGE_TRANSITION_LINK, false));
-  return false;  // Do not dismiss the info bar.
-}