| 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/ui/search/instant_controller.h" | 5 #include "chrome/browser/ui/search/instant_controller.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 CommitIfPossible(INSTANT_COMMIT_FOCUS_LOST); | 1272 CommitIfPossible(INSTANT_COMMIT_FOCUS_LOST); |
| 1273 else if (!IsViewInContents(GetViewGainingFocus(view_gaining_focus), | 1273 else if (!IsViewInContents(GetViewGainingFocus(view_gaining_focus), |
| 1274 overlay_->contents())) | 1274 overlay_->contents())) |
| 1275 HideOverlay(); | 1275 HideOverlay(); |
| 1276 #endif | 1276 #endif |
| 1277 } | 1277 } |
| 1278 | 1278 |
| 1279 void InstantController::ResetNTP(bool ignore_blacklist) { | 1279 void InstantController::ResetNTP(bool ignore_blacklist) { |
| 1280 ntp_.reset(); | 1280 ntp_.reset(); |
| 1281 std::string instant_url; | 1281 std::string instant_url; |
| 1282 if (!GetInstantURL(browser_->profile(), ignore_blacklist, &instant_url)) { | 1282 if (browser_->profile()->IsOffTheRecord() || |
| 1283 !GetInstantURL(browser_->profile(), ignore_blacklist, &instant_url)) { |
| 1283 // TODO(sreeram|samarth): use local ntp here once available. | 1284 // TODO(sreeram|samarth): use local ntp here once available. |
| 1284 return; | 1285 return; |
| 1285 } | 1286 } |
| 1286 ntp_.reset(new InstantNTP(this, instant_url)); | 1287 ntp_.reset(new InstantNTP(this, instant_url)); |
| 1287 ntp_->InitContents(browser_->profile(), browser_->GetActiveWebContents(), | 1288 ntp_->InitContents(browser_->profile(), browser_->GetActiveWebContents(), |
| 1288 base::Bind(&InstantController::ResetNTP, | 1289 base::Bind(&InstantController::ResetNTP, |
| 1289 base::Unretained(this), false)); | 1290 base::Unretained(this), false)); |
| 1290 } | 1291 } |
| 1291 | 1292 |
| 1292 bool InstantController::EnsureOverlayIsCurrent(bool ignore_blacklist) { | 1293 bool InstantController::EnsureOverlayIsCurrent(bool ignore_blacklist) { |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1623 // for instance, if the user types 'i' and the suggestion is 'INSTANT', | 1624 // for instance, if the user types 'i' and the suggestion is 'INSTANT', |
| 1624 // suggest 'nstant'. Otherwise, the user text really isn't a prefix, so | 1625 // suggest 'nstant'. Otherwise, the user text really isn't a prefix, so |
| 1625 // suggest nothing. | 1626 // suggest nothing. |
| 1626 // TODO(samarth|jered): revisit this logic. http://crbug.com/196572. | 1627 // TODO(samarth|jered): revisit this logic. http://crbug.com/196572. |
| 1627 return true; | 1628 return true; |
| 1628 } | 1629 } |
| 1629 } | 1630 } |
| 1630 | 1631 |
| 1631 return false; | 1632 return false; |
| 1632 } | 1633 } |
| OLD | NEW |