Chromium Code Reviews| 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 "apps/app_launcher.h" | 7 #include "apps/app_launcher.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/search/search.h" | 9 #include "chrome/browser/search/search.h" |
| 10 #include "chrome/browser/ui/search/instant_ipc_sender.h" | 10 #include "chrome/browser/ui/search/instant_ipc_sender.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 return false; | 136 return false; |
| 137 | 137 |
| 138 bool handled = true; | 138 bool handled = true; |
| 139 IPC_BEGIN_MESSAGE_MAP(InstantPage, message) | 139 IPC_BEGIN_MESSAGE_MAP(InstantPage, message) |
| 140 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetSuggestions, OnSetSuggestions) | 140 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetSuggestions, OnSetSuggestions) |
| 141 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowInstantOverlay, | 141 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowInstantOverlay, |
| 142 OnShowInstantOverlay) | 142 OnShowInstantOverlay) |
| 143 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FocusOmnibox, OnFocusOmnibox) | 143 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FocusOmnibox, OnFocusOmnibox) |
| 144 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxNavigate, | 144 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxNavigate, |
| 145 OnSearchBoxNavigate); | 145 OnSearchBoxNavigate); |
| 146 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_LogIframeHover, OnLogIframeHover); | |
| 146 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem, | 147 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem, |
| 147 OnDeleteMostVisitedItem); | 148 OnDeleteMostVisitedItem); |
| 148 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion, | 149 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion, |
| 149 OnUndoMostVisitedDeletion); | 150 OnUndoMostVisitedDeletion); |
| 150 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions, | 151 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions, |
| 151 OnUndoAllMostVisitedDeletions); | 152 OnUndoAllMostVisitedDeletions); |
| 152 IPC_MESSAGE_UNHANDLED(handled = false) | 153 IPC_MESSAGE_UNHANDLED(handled = false) |
| 153 IPC_END_MESSAGE_MAP() | 154 IPC_END_MESSAGE_MAP() |
| 154 return handled; | 155 return handled; |
| 155 } | 156 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 return; | 252 return; |
| 252 | 253 |
| 253 SearchTabHelper::FromWebContents(contents())->InstantSupportChanged(true); | 254 SearchTabHelper::FromWebContents(contents())->InstantSupportChanged(true); |
| 254 if (!ShouldProcessNavigateToURL()) | 255 if (!ShouldProcessNavigateToURL()) |
| 255 return; | 256 return; |
| 256 | 257 |
| 257 delegate_->NavigateToURL( | 258 delegate_->NavigateToURL( |
| 258 contents(), url, transition, disposition, is_search_type); | 259 contents(), url, transition, disposition, is_search_type); |
| 259 } | 260 } |
| 260 | 261 |
| 262 void InstantPage::OnLogIframeHover(int page_id) { | |
| 263 if (!contents()->IsActiveEntry(page_id)) | |
| 264 return; | |
| 265 | |
| 266 delegate_->LogIframeHover(); | |
|
Jered
2013/06/28 16:24:17
Here, call InstantNTP::LogIframeHover(contents()).
annark1
2013/06/28 18:38:22
Done.
| |
| 267 } | |
| 268 | |
| 261 void InstantPage::OnDeleteMostVisitedItem(int page_id, const GURL& url) { | 269 void InstantPage::OnDeleteMostVisitedItem(int page_id, const GURL& url) { |
| 262 if (!contents()->IsActiveEntry(page_id)) | 270 if (!contents()->IsActiveEntry(page_id)) |
| 263 return; | 271 return; |
| 264 | 272 |
| 265 SearchTabHelper::FromWebContents(contents())->InstantSupportChanged(true); | 273 SearchTabHelper::FromWebContents(contents())->InstantSupportChanged(true); |
| 266 if (!ShouldProcessDeleteMostVisitedItem()) | 274 if (!ShouldProcessDeleteMostVisitedItem()) |
| 267 return; | 275 return; |
| 268 | 276 |
| 269 delegate_->DeleteMostVisitedItem(url); | 277 delegate_->DeleteMostVisitedItem(url); |
| 270 } | 278 } |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 291 delegate_->UndoAllMostVisitedDeletions(); | 299 delegate_->UndoAllMostVisitedDeletions(); |
| 292 } | 300 } |
| 293 | 301 |
| 294 void InstantPage::ClearContents() { | 302 void InstantPage::ClearContents() { |
| 295 if (contents()) | 303 if (contents()) |
| 296 SearchTabHelper::FromWebContents(contents())->model()->RemoveObserver(this); | 304 SearchTabHelper::FromWebContents(contents())->model()->RemoveObserver(this); |
| 297 | 305 |
| 298 sender()->SetContents(NULL); | 306 sender()->SetContents(NULL); |
| 299 Observe(NULL); | 307 Observe(NULL); |
| 300 } | 308 } |
| OLD | NEW |