| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_page.h" | 5 #include "chrome/browser/ui/search/instant_page.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/search/search.h" | 8 #include "chrome/browser/search/search.h" |
| 9 #include "chrome/browser/ui/search/search_model.h" | 9 #include "chrome/browser/ui/search/search_model.h" |
| 10 #include "chrome/browser/ui/search/search_tab_helper.h" | 10 #include "chrome/browser/ui/search/search_tab_helper.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 200 |
| 201 bool InstantPage::OnMessageReceived(const IPC::Message& message) { | 201 bool InstantPage::OnMessageReceived(const IPC::Message& message) { |
| 202 bool handled = true; | 202 bool handled = true; |
| 203 IPC_BEGIN_MESSAGE_MAP(InstantPage, message) | 203 IPC_BEGIN_MESSAGE_MAP(InstantPage, message) |
| 204 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetSuggestions, OnSetSuggestions) | 204 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetSuggestions, OnSetSuggestions) |
| 205 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowInstantOverlay, | 205 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowInstantOverlay, |
| 206 OnShowInstantOverlay) | 206 OnShowInstantOverlay) |
| 207 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FocusOmnibox, OnFocusOmnibox) | 207 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FocusOmnibox, OnFocusOmnibox) |
| 208 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxNavigate, | 208 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxNavigate, |
| 209 OnSearchBoxNavigate); | 209 OnSearchBoxNavigate); |
| 210 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxLogIframeHover, |
| 211 OnSearchBoxLogIframeHover); |
| 210 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem, | 212 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem, |
| 211 OnDeleteMostVisitedItem); | 213 OnDeleteMostVisitedItem); |
| 212 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion, | 214 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion, |
| 213 OnUndoMostVisitedDeletion); | 215 OnUndoMostVisitedDeletion); |
| 214 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions, | 216 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions, |
| 215 OnUndoAllMostVisitedDeletions); | 217 OnUndoAllMostVisitedDeletions); |
| 216 IPC_MESSAGE_UNHANDLED(handled = false) | 218 IPC_MESSAGE_UNHANDLED(handled = false) |
| 217 IPC_END_MESSAGE_MAP() | 219 IPC_END_MESSAGE_MAP() |
| 218 return handled; | 220 return handled; |
| 219 } | 221 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 return; | 317 return; |
| 316 | 318 |
| 317 SearchTabHelper::FromWebContents(contents())->InstantSupportChanged(true); | 319 SearchTabHelper::FromWebContents(contents())->InstantSupportChanged(true); |
| 318 if (!ShouldProcessNavigateToURL()) | 320 if (!ShouldProcessNavigateToURL()) |
| 319 return; | 321 return; |
| 320 | 322 |
| 321 delegate_->NavigateToURL( | 323 delegate_->NavigateToURL( |
| 322 contents(), url, transition, disposition, is_search_type); | 324 contents(), url, transition, disposition, is_search_type); |
| 323 } | 325 } |
| 324 | 326 |
| 327 void InstantPage::OnSearchBoxLogIframeHover(int page_id, int pos) { |
| 328 if (!contents()->IsActiveEntry(page_id)) |
| 329 return; |
| 330 |
| 331 delegate_->LogIframeHover(pos); |
| 332 } |
| 333 |
| 325 void InstantPage::OnDeleteMostVisitedItem(int page_id, const GURL& url) { | 334 void InstantPage::OnDeleteMostVisitedItem(int page_id, const GURL& url) { |
| 326 if (!contents()->IsActiveEntry(page_id)) | 335 if (!contents()->IsActiveEntry(page_id)) |
| 327 return; | 336 return; |
| 328 | 337 |
| 329 SearchTabHelper::FromWebContents(contents())->InstantSupportChanged(true); | 338 SearchTabHelper::FromWebContents(contents())->InstantSupportChanged(true); |
| 330 if (!ShouldProcessDeleteMostVisitedItem()) | 339 if (!ShouldProcessDeleteMostVisitedItem()) |
| 331 return; | 340 return; |
| 332 | 341 |
| 333 delegate_->DeleteMostVisitedItem(url); | 342 delegate_->DeleteMostVisitedItem(url); |
| 334 } | 343 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 354 | 363 |
| 355 delegate_->UndoAllMostVisitedDeletions(); | 364 delegate_->UndoAllMostVisitedDeletions(); |
| 356 } | 365 } |
| 357 | 366 |
| 358 void InstantPage::ClearContents() { | 367 void InstantPage::ClearContents() { |
| 359 if (contents()) | 368 if (contents()) |
| 360 SearchTabHelper::FromWebContents(contents())->model()->RemoveObserver(this); | 369 SearchTabHelper::FromWebContents(contents())->model()->RemoveObserver(this); |
| 361 | 370 |
| 362 Observe(NULL); | 371 Observe(NULL); |
| 363 } | 372 } |
| OLD | NEW |