| 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 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 // Nothing to do if omnibox doesn't have invisible focus. | 1099 // Nothing to do if omnibox doesn't have invisible focus. |
| 1100 if (!extended_enabled_ || omnibox_focus_state_ != OMNIBOX_FOCUS_INVISIBLE) | 1100 if (!extended_enabled_ || omnibox_focus_state_ != OMNIBOX_FOCUS_INVISIBLE) |
| 1101 return; | 1101 return; |
| 1102 | 1102 |
| 1103 DCHECK(IsContentsFrom(instant_tab(), contents)); | 1103 DCHECK(IsContentsFrom(instant_tab(), contents)); |
| 1104 contents->Focus(); | 1104 contents->Focus(); |
| 1105 } | 1105 } |
| 1106 | 1106 |
| 1107 void InstantController::NavigateToURL(const content::WebContents* contents, | 1107 void InstantController::NavigateToURL(const content::WebContents* contents, |
| 1108 const GURL& url, | 1108 const GURL& url, |
| 1109 content::PageTransition transition) { | 1109 content::PageTransition transition, |
| 1110 WindowOpenDisposition disposition) { |
| 1111 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( |
| 1112 "NavigateToURL: url='%s'", url.spec().c_str())); |
| 1113 |
| 1110 // TODO(samarth): handle case where contents are no longer "active" (e.g. user | 1114 // TODO(samarth): handle case where contents are no longer "active" (e.g. user |
| 1111 // has switched tabs). | 1115 // has switched tabs). |
| 1112 if (!extended_enabled_) | 1116 if (!extended_enabled_) |
| 1113 return; | 1117 return; |
| 1114 if (overlay_) | 1118 if (overlay_) |
| 1115 HideOverlay(); | 1119 HideOverlay(); |
| 1116 browser_->OpenURLInCurrentTab(url, transition); | 1120 browser_->OpenURL(url, transition, disposition); |
| 1117 } | 1121 } |
| 1118 | 1122 |
| 1119 void InstantController::OmniboxLostFocus(gfx::NativeView view_gaining_focus) { | 1123 void InstantController::OmniboxLostFocus(gfx::NativeView view_gaining_focus) { |
| 1120 // If the preview is showing custom NTP content, don't hide it, commit it | 1124 // If the preview is showing custom NTP content, don't hide it, commit it |
| 1121 // (no matter where the user clicked) or try to recreate it. | 1125 // (no matter where the user clicked) or try to recreate it. |
| 1122 if (model_.mode().is_ntp()) | 1126 if (model_.mode().is_ntp()) |
| 1123 return; | 1127 return; |
| 1124 | 1128 |
| 1125 // If the preview is not showing at all, recreate it if it's stale. | 1129 // If the preview is not showing at all, recreate it if it's stale. |
| 1126 if (model_.mode().is_default()) { | 1130 if (model_.mode().is_default()) { |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1503 overlay_->SendMostVisitedItems(items); | 1507 overlay_->SendMostVisitedItems(items); |
| 1504 if (ntp_) | 1508 if (ntp_) |
| 1505 ntp_->SendMostVisitedItems(items); | 1509 ntp_->SendMostVisitedItems(items); |
| 1506 if (instant_tab_) | 1510 if (instant_tab_) |
| 1507 instant_tab_->SendMostVisitedItems(items); | 1511 instant_tab_->SendMostVisitedItems(items); |
| 1508 content::NotificationService::current()->Notify( | 1512 content::NotificationService::current()->Notify( |
| 1509 chrome::NOTIFICATION_INSTANT_SENT_MOST_VISITED_ITEMS, | 1513 chrome::NOTIFICATION_INSTANT_SENT_MOST_VISITED_ITEMS, |
| 1510 content::Source<InstantController>(this), | 1514 content::Source<InstantController>(this), |
| 1511 content::NotificationService::NoDetails()); | 1515 content::NotificationService::NoDetails()); |
| 1512 } | 1516 } |
| OLD | NEW |