OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/instant/instant_controller.h" | 5 #include "chrome/browser/instant/instant_controller.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 // Nothing to do if omnibox doesn't have invisible focus. | 1062 // Nothing to do if omnibox doesn't have invisible focus. |
1063 if (!extended_enabled_ || omnibox_focus_state_ != OMNIBOX_FOCUS_INVISIBLE) | 1063 if (!extended_enabled_ || omnibox_focus_state_ != OMNIBOX_FOCUS_INVISIBLE) |
1064 return; | 1064 return; |
1065 | 1065 |
1066 DCHECK(IsContentsFrom(instant_tab(), contents)); | 1066 DCHECK(IsContentsFrom(instant_tab(), contents)); |
1067 contents->Focus(); | 1067 contents->Focus(); |
1068 } | 1068 } |
1069 | 1069 |
1070 void InstantController::NavigateToURL(const content::WebContents* contents, | 1070 void InstantController::NavigateToURL(const content::WebContents* contents, |
1071 const GURL& url, | 1071 const GURL& url, |
1072 content::PageTransition transition) { | 1072 content::PageTransition transition, |
| 1073 WindowOpenDisposition disposition) { |
| 1074 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( |
| 1075 "NavigateToURL: url='%s'", url.spec().c_str())); |
| 1076 |
1073 // TODO(samarth): handle case where contents are no longer "active" (e.g. user | 1077 // TODO(samarth): handle case where contents are no longer "active" (e.g. user |
1074 // has switched tabs). | 1078 // has switched tabs). |
1075 if (!extended_enabled_) | 1079 if (!extended_enabled_) |
1076 return; | 1080 return; |
1077 if (overlay_) | 1081 if (overlay_) |
1078 HideOverlay(); | 1082 HideOverlay(); |
1079 browser_->OpenURLInCurrentTab(url, transition); | 1083 browser_->OpenURL(url, transition, disposition); |
1080 } | 1084 } |
1081 | 1085 |
1082 void InstantController::OmniboxLostFocus(gfx::NativeView view_gaining_focus) { | 1086 void InstantController::OmniboxLostFocus(gfx::NativeView view_gaining_focus) { |
1083 // If the preview is showing custom NTP content, don't hide it, commit it | 1087 // If the preview is showing custom NTP content, don't hide it, commit it |
1084 // (no matter where the user clicked) or try to recreate it. | 1088 // (no matter where the user clicked) or try to recreate it. |
1085 if (model_.mode().is_ntp()) | 1089 if (model_.mode().is_ntp()) |
1086 return; | 1090 return; |
1087 | 1091 |
1088 // If the preview is not showing at all, recreate it if it's stale. | 1092 // If the preview is not showing at all, recreate it if it's stale. |
1089 if (model_.mode().is_default()) { | 1093 if (model_.mode().is_default()) { |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 delete overlay_->ReleaseContents().release(); | 1408 delete overlay_->ReleaseContents().release(); |
1405 MessageLoop::current()->DeleteSoon(FROM_HERE, overlay_.release()); | 1409 MessageLoop::current()->DeleteSoon(FROM_HERE, overlay_.release()); |
1406 EnsureOverlayIsCurrent(false); | 1410 EnsureOverlayIsCurrent(false); |
1407 } | 1411 } |
1408 | 1412 |
1409 void InstantController::RemoveFromBlacklist(const std::string& url) { | 1413 void InstantController::RemoveFromBlacklist(const std::string& url) { |
1410 if (blacklisted_urls_.erase(url)) { | 1414 if (blacklisted_urls_.erase(url)) { |
1411 RecordEventHistogram(INSTANT_CONTROLLER_EVENT_URL_REMOVED_FROM_BLACKLIST); | 1415 RecordEventHistogram(INSTANT_CONTROLLER_EVENT_URL_REMOVED_FROM_BLACKLIST); |
1412 } | 1416 } |
1413 } | 1417 } |
OLD | NEW |