Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / toolbar / toolbar_controller.mm
index 51bd7d9..d1580aa 100644 (file)
@@ -16,6 +16,7 @@
 #include "chrome/app/chrome_command_ids.h"
 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
+#include "chrome/browser/autocomplete/autocomplete_input.h"
 #include "chrome/browser/autocomplete/autocomplete_match.h"
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/command_updater.h"
@@ -397,8 +398,18 @@ class NotificationBridge
 }
 
 - (void)focusLocationBar:(BOOL)selectAll {
-  if (locationBarView_.get())
-    locationBarView_->FocusLocation(selectAll ? true : false);
+  if (locationBarView_.get()) {
+    if (selectAll &&
+        locationBarView_->GetToolbarModel()->WouldOmitURLDueToOriginChip()) {
+      // select_all is true when it's expected that the user may want to copy
+      // the URL to the clipboard. If the origin chip is being displayed (and
+      // thus the URL is not being shown in the Omnibox) show it now to support
+      // the same functionality.
+      locationBarView_->GetOmniboxView()->ShowURL();
+    } else {
+      locationBarView_->FocusLocation(selectAll ? true : false);
+    }
+  }
 }
 
 // Called when the state for a command changes to |enabled|. Update the
@@ -800,7 +811,8 @@ class NotificationBridge
   // If the input is plain text, classify the input and make the URL.
   AutocompleteMatch match;
   AutocompleteClassifierFactory::GetForProfile(browser_->profile())->Classify(
-      base::SysNSStringToUTF16(text), false, false, &match, NULL);
+      base::SysNSStringToUTF16(text), false, false, AutocompleteInput::BLANK,
+      &match, NULL);
   GURL url(match.destination_url);
 
   OpenURLParams params(