| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_loader.h" | 5 #include "chrome/browser/instant/instant_loader.h" |
| 6 | 6 |
| 7 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 7 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 8 #include "chrome/browser/history/history_types.h" | 8 #include "chrome/browser/history/history_types.h" |
| 9 #include "chrome/browser/instant/instant_loader_delegate.h" | 9 #include "chrome/browser/instant/instant_loader_delegate.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } | 302 } |
| 303 | 303 |
| 304 void InstantLoader::SendAutocompleteResults( | 304 void InstantLoader::SendAutocompleteResults( |
| 305 const std::vector<InstantAutocompleteResult>& results) { | 305 const std::vector<InstantAutocompleteResult>& results) { |
| 306 content::RenderViewHost* rvh = | 306 content::RenderViewHost* rvh = |
| 307 preview_contents_->web_contents()->GetRenderViewHost(); | 307 preview_contents_->web_contents()->GetRenderViewHost(); |
| 308 rvh->Send(new ChromeViewMsg_SearchBoxAutocompleteResults(rvh->GetRoutingID(), | 308 rvh->Send(new ChromeViewMsg_SearchBoxAutocompleteResults(rvh->GetRoutingID(), |
| 309 results)); | 309 results)); |
| 310 } | 310 } |
| 311 | 311 |
| 312 void InstantLoader::OnUpOrDownKeyPressed(int count) { |
| 313 content::RenderViewHost* rvh = |
| 314 preview_contents_->web_contents()->GetRenderViewHost(); |
| 315 rvh->Send(new ChromeViewMsg_SearchBoxUpOrDownKeyPressed(rvh->GetRoutingID(), |
| 316 count)); |
| 317 } |
| 318 |
| 312 TabContents* InstantLoader::ReleasePreviewContents(InstantCommitType type, | 319 TabContents* InstantLoader::ReleasePreviewContents(InstantCommitType type, |
| 313 const string16& text) { | 320 const string16& text) { |
| 314 content::RenderViewHost* rvh = | 321 content::RenderViewHost* rvh = |
| 315 preview_contents_->web_contents()->GetRenderViewHost(); | 322 preview_contents_->web_contents()->GetRenderViewHost(); |
| 316 if (type == INSTANT_COMMIT_PRESSED_ENTER) | 323 if (type == INSTANT_COMMIT_PRESSED_ENTER) |
| 317 rvh->Send(new ChromeViewMsg_SearchBoxSubmit(rvh->GetRoutingID(), text)); | 324 rvh->Send(new ChromeViewMsg_SearchBoxSubmit(rvh->GetRoutingID(), text)); |
| 318 else | 325 else |
| 319 rvh->Send(new ChromeViewMsg_SearchBoxCancel(rvh->GetRoutingID(), text)); | 326 rvh->Send(new ChromeViewMsg_SearchBoxCancel(rvh->GetRoutingID(), text)); |
| 320 CleanupPreviewContents(); | 327 CleanupPreviewContents(); |
| 321 return preview_contents_.release(); | 328 return preview_contents_.release(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 TabContents* new_tc) { | 401 TabContents* new_tc) { |
| 395 DCHECK(old_tc == preview_contents_); | 402 DCHECK(old_tc == preview_contents_); |
| 396 CleanupPreviewContents(); | 403 CleanupPreviewContents(); |
| 397 // We release here without deleting so that the caller still has the | 404 // We release here without deleting so that the caller still has the |
| 398 // responsibility for deleting the TabContents. | 405 // responsibility for deleting the TabContents. |
| 399 ignore_result(preview_contents_.release()); | 406 ignore_result(preview_contents_.release()); |
| 400 preview_contents_.reset(new_tc); | 407 preview_contents_.reset(new_tc); |
| 401 SetupPreviewContents(); | 408 SetupPreviewContents(); |
| 402 loader_delegate_->SwappedTabContents(this); | 409 loader_delegate_->SwappedTabContents(this); |
| 403 } | 410 } |
| OLD | NEW |