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/renderer/searchbox/searchbox.h" | 5 #include "chrome/renderer/searchbox/searchbox.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 const base::string16& provider) { | 170 const base::string16& provider) { |
171 render_view()->Send(new ChromeViewHostMsg_LogMostVisitedNavigation( | 171 render_view()->Send(new ChromeViewHostMsg_LogMostVisitedNavigation( |
172 render_view()->GetRoutingID(), page_seq_no_, position, provider)); | 172 render_view()->GetRoutingID(), page_seq_no_, position, provider)); |
173 } | 173 } |
174 | 174 |
175 void SearchBox::CheckIsUserSignedInToChromeAs(const base::string16& identity) { | 175 void SearchBox::CheckIsUserSignedInToChromeAs(const base::string16& identity) { |
176 render_view()->Send(new ChromeViewHostMsg_ChromeIdentityCheck( | 176 render_view()->Send(new ChromeViewHostMsg_ChromeIdentityCheck( |
177 render_view()->GetRoutingID(), page_seq_no_, identity)); | 177 render_view()->GetRoutingID(), page_seq_no_, identity)); |
178 } | 178 } |
179 | 179 |
| 180 void SearchBox::CheckIsUserSyncingHistory() { |
| 181 render_view()->Send(new ChromeViewHostMsg_HistorySyncCheck( |
| 182 render_view()->GetRoutingID(), page_seq_no_)); |
| 183 } |
| 184 |
180 void SearchBox::DeleteMostVisitedItem( | 185 void SearchBox::DeleteMostVisitedItem( |
181 InstantRestrictedID most_visited_item_id) { | 186 InstantRestrictedID most_visited_item_id) { |
182 render_view()->Send(new ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem( | 187 render_view()->Send(new ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem( |
183 render_view()->GetRoutingID(), | 188 render_view()->GetRoutingID(), |
184 page_seq_no_, | 189 page_seq_no_, |
185 GetURLForMostVisitedItem(most_visited_item_id))); | 190 GetURLForMostVisitedItem(most_visited_item_id))); |
186 } | 191 } |
187 | 192 |
188 bool SearchBox::GenerateFaviconURLFromTransientURL(const GURL& transient_url, | 193 bool SearchBox::GenerateFaviconURLFromTransientURL(const GURL& transient_url, |
189 GURL* url) const { | 194 GURL* url) const { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 290 |
286 bool SearchBox::OnMessageReceived(const IPC::Message& message) { | 291 bool SearchBox::OnMessageReceived(const IPC::Message& message) { |
287 bool handled = true; | 292 bool handled = true; |
288 IPC_BEGIN_MESSAGE_MAP(SearchBox, message) | 293 IPC_BEGIN_MESSAGE_MAP(SearchBox, message) |
289 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetPageSequenceNumber, | 294 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetPageSequenceNumber, |
290 OnSetPageSequenceNumber) | 295 OnSetPageSequenceNumber) |
291 IPC_MESSAGE_HANDLER(ChromeViewMsg_ChromeIdentityCheckResult, | 296 IPC_MESSAGE_HANDLER(ChromeViewMsg_ChromeIdentityCheckResult, |
292 OnChromeIdentityCheckResult) | 297 OnChromeIdentityCheckResult) |
293 IPC_MESSAGE_HANDLER(ChromeViewMsg_DetermineIfPageSupportsInstant, | 298 IPC_MESSAGE_HANDLER(ChromeViewMsg_DetermineIfPageSupportsInstant, |
294 OnDetermineIfPageSupportsInstant) | 299 OnDetermineIfPageSupportsInstant) |
| 300 IPC_MESSAGE_HANDLER(ChromeViewMsg_HistorySyncCheckResult, |
| 301 OnHistorySyncCheckResult) |
295 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxFocusChanged, OnFocusChanged) | 302 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxFocusChanged, OnFocusChanged) |
296 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMarginChange, OnMarginChange) | 303 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMarginChange, OnMarginChange) |
297 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMostVisitedItemsChanged, | 304 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMostVisitedItemsChanged, |
298 OnMostVisitedChanged) | 305 OnMostVisitedChanged) |
299 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxPromoInformation, | 306 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxPromoInformation, |
300 OnPromoInformationReceived) | 307 OnPromoInformationReceived) |
301 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults, | 308 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults, |
302 OnSetDisplayInstantResults) | 309 OnSetDisplayInstantResults) |
303 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetInputInProgress, | 310 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetInputInProgress, |
304 OnSetInputInProgress) | 311 OnSetInputInProgress) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 is_focused_ = is_focused; | 369 is_focused_ = is_focused; |
363 DVLOG(1) << render_view() << " OnFocusChange"; | 370 DVLOG(1) << render_view() << " OnFocusChange"; |
364 if (render_view()->GetWebView() && | 371 if (render_view()->GetWebView() && |
365 render_view()->GetWebView()->mainFrame()) { | 372 render_view()->GetWebView()->mainFrame()) { |
366 extensions_v8::SearchBoxExtension::DispatchFocusChange( | 373 extensions_v8::SearchBoxExtension::DispatchFocusChange( |
367 render_view()->GetWebView()->mainFrame()); | 374 render_view()->GetWebView()->mainFrame()); |
368 } | 375 } |
369 } | 376 } |
370 } | 377 } |
371 | 378 |
| 379 void SearchBox::OnHistorySyncCheckResult(bool sync_history) { |
| 380 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { |
| 381 extensions_v8::SearchBoxExtension::DispatchHistorySyncCheckResult( |
| 382 render_view()->GetWebView()->mainFrame(), sync_history); |
| 383 } |
| 384 } |
| 385 |
372 void SearchBox::OnMarginChange(int margin) { | 386 void SearchBox::OnMarginChange(int margin) { |
373 start_margin_ = margin; | 387 start_margin_ = margin; |
374 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { | 388 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { |
375 extensions_v8::SearchBoxExtension::DispatchMarginChange( | 389 extensions_v8::SearchBoxExtension::DispatchMarginChange( |
376 render_view()->GetWebView()->mainFrame()); | 390 render_view()->GetWebView()->mainFrame()); |
377 } | 391 } |
378 } | 392 } |
379 | 393 |
380 void SearchBox::OnMostVisitedChanged( | 394 void SearchBox::OnMostVisitedChanged( |
381 const std::vector<InstantMostVisitedItem>& items) { | 395 const std::vector<InstantMostVisitedItem>& items) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 } | 476 } |
463 | 477 |
464 void SearchBox::Reset() { | 478 void SearchBox::Reset() { |
465 query_.clear(); | 479 query_.clear(); |
466 suggestion_ = InstantSuggestion(); | 480 suggestion_ = InstantSuggestion(); |
467 start_margin_ = 0; | 481 start_margin_ = 0; |
468 is_focused_ = false; | 482 is_focused_ = false; |
469 is_key_capture_enabled_ = false; | 483 is_key_capture_enabled_ = false; |
470 theme_info_ = ThemeBackgroundInfo(); | 484 theme_info_ = ThemeBackgroundInfo(); |
471 } | 485 } |
OLD | NEW |