| 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/instant_ipc_sender.h" | 9 #include "chrome/browser/ui/search/instant_ipc_sender.h" |
| 10 #include "chrome/browser/ui/search/search_model.h" | 10 #include "chrome/browser/ui/search/search_model.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 return false; | 131 return false; |
| 132 | 132 |
| 133 bool handled = true; | 133 bool handled = true; |
| 134 IPC_BEGIN_MESSAGE_MAP(InstantPage, message) | 134 IPC_BEGIN_MESSAGE_MAP(InstantPage, message) |
| 135 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetSuggestions, OnSetSuggestions) | 135 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetSuggestions, OnSetSuggestions) |
| 136 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowInstantOverlay, | 136 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowInstantOverlay, |
| 137 OnShowInstantOverlay) | 137 OnShowInstantOverlay) |
| 138 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FocusOmnibox, OnFocusOmnibox) | 138 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FocusOmnibox, OnFocusOmnibox) |
| 139 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxNavigate, | 139 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxNavigate, |
| 140 OnSearchBoxNavigate); | 140 OnSearchBoxNavigate); |
| 141 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_LogIframeHover, OnLogIframeHover); |
| 141 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem, | 142 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem, |
| 142 OnDeleteMostVisitedItem); | 143 OnDeleteMostVisitedItem); |
| 143 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion, | 144 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion, |
| 144 OnUndoMostVisitedDeletion); | 145 OnUndoMostVisitedDeletion); |
| 145 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions, | 146 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions, |
| 146 OnUndoAllMostVisitedDeletions); | 147 OnUndoAllMostVisitedDeletions); |
| 147 IPC_MESSAGE_UNHANDLED(handled = false) | 148 IPC_MESSAGE_UNHANDLED(handled = false) |
| 148 IPC_END_MESSAGE_MAP() | 149 IPC_END_MESSAGE_MAP() |
| 149 return handled; | 150 return handled; |
| 150 } | 151 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 return; | 247 return; |
| 247 | 248 |
| 248 SearchTabHelper::FromWebContents(contents())->InstantSupportChanged(true); | 249 SearchTabHelper::FromWebContents(contents())->InstantSupportChanged(true); |
| 249 if (!ShouldProcessNavigateToURL()) | 250 if (!ShouldProcessNavigateToURL()) |
| 250 return; | 251 return; |
| 251 | 252 |
| 252 delegate_->NavigateToURL( | 253 delegate_->NavigateToURL( |
| 253 contents(), url, transition, disposition, is_search_type); | 254 contents(), url, transition, disposition, is_search_type); |
| 254 } | 255 } |
| 255 | 256 |
| 257 void InstantPage::OnLogIframeHover(int page_id) { |
| 258 if (!contents()->IsActiveEntry(page_id)) |
| 259 return; |
| 260 |
| 261 delegate_->LogIframeHover(); |
| 262 } |
| 263 |
| 256 void InstantPage::OnDeleteMostVisitedItem(int page_id, const GURL& url) { | 264 void InstantPage::OnDeleteMostVisitedItem(int page_id, const GURL& url) { |
| 257 if (!contents()->IsActiveEntry(page_id)) | 265 if (!contents()->IsActiveEntry(page_id)) |
| 258 return; | 266 return; |
| 259 | 267 |
| 260 SearchTabHelper::FromWebContents(contents())->InstantSupportChanged(true); | 268 SearchTabHelper::FromWebContents(contents())->InstantSupportChanged(true); |
| 261 if (!ShouldProcessDeleteMostVisitedItem()) | 269 if (!ShouldProcessDeleteMostVisitedItem()) |
| 262 return; | 270 return; |
| 263 | 271 |
| 264 delegate_->DeleteMostVisitedItem(url); | 272 delegate_->DeleteMostVisitedItem(url); |
| 265 } | 273 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 286 delegate_->UndoAllMostVisitedDeletions(); | 294 delegate_->UndoAllMostVisitedDeletions(); |
| 287 } | 295 } |
| 288 | 296 |
| 289 void InstantPage::ClearContents() { | 297 void InstantPage::ClearContents() { |
| 290 if (contents()) | 298 if (contents()) |
| 291 SearchTabHelper::FromWebContents(contents())->model()->RemoveObserver(this); | 299 SearchTabHelper::FromWebContents(contents())->model()->RemoveObserver(this); |
| 292 | 300 |
| 293 sender()->SetContents(NULL); | 301 sender()->SetContents(NULL); |
| 294 Observe(NULL); | 302 Observe(NULL); |
| 295 } | 303 } |
| OLD | NEW |