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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 294 |
290 bool SearchBox::OnMessageReceived(const IPC::Message& message) { | 295 bool SearchBox::OnMessageReceived(const IPC::Message& message) { |
291 bool handled = true; | 296 bool handled = true; |
292 IPC_BEGIN_MESSAGE_MAP(SearchBox, message) | 297 IPC_BEGIN_MESSAGE_MAP(SearchBox, message) |
293 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetPageSequenceNumber, | 298 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetPageSequenceNumber, |
294 OnSetPageSequenceNumber) | 299 OnSetPageSequenceNumber) |
295 IPC_MESSAGE_HANDLER(ChromeViewMsg_ChromeIdentityCheckResult, | 300 IPC_MESSAGE_HANDLER(ChromeViewMsg_ChromeIdentityCheckResult, |
296 OnChromeIdentityCheckResult) | 301 OnChromeIdentityCheckResult) |
297 IPC_MESSAGE_HANDLER(ChromeViewMsg_DetermineIfPageSupportsInstant, | 302 IPC_MESSAGE_HANDLER(ChromeViewMsg_DetermineIfPageSupportsInstant, |
298 OnDetermineIfPageSupportsInstant) | 303 OnDetermineIfPageSupportsInstant) |
| 304 IPC_MESSAGE_HANDLER(ChromeViewMsg_HistorySyncCheckResult, |
| 305 OnHistorySyncCheckResult) |
299 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxFocusChanged, OnFocusChanged) | 306 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxFocusChanged, OnFocusChanged) |
300 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMarginChange, OnMarginChange) | 307 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMarginChange, OnMarginChange) |
301 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMostVisitedItemsChanged, | 308 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMostVisitedItemsChanged, |
302 OnMostVisitedChanged) | 309 OnMostVisitedChanged) |
303 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxPromoInformation, | 310 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxPromoInformation, |
304 OnPromoInformationReceived) | 311 OnPromoInformationReceived) |
305 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults, | 312 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults, |
306 OnSetDisplayInstantResults) | 313 OnSetDisplayInstantResults) |
307 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetInputInProgress, | 314 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetInputInProgress, |
308 OnSetInputInProgress) | 315 OnSetInputInProgress) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 is_focused_ = is_focused; | 373 is_focused_ = is_focused; |
367 DVLOG(1) << render_view() << " OnFocusChange"; | 374 DVLOG(1) << render_view() << " OnFocusChange"; |
368 if (render_view()->GetWebView() && | 375 if (render_view()->GetWebView() && |
369 render_view()->GetWebView()->mainFrame()) { | 376 render_view()->GetWebView()->mainFrame()) { |
370 extensions_v8::SearchBoxExtension::DispatchFocusChange( | 377 extensions_v8::SearchBoxExtension::DispatchFocusChange( |
371 render_view()->GetWebView()->mainFrame()); | 378 render_view()->GetWebView()->mainFrame()); |
372 } | 379 } |
373 } | 380 } |
374 } | 381 } |
375 | 382 |
| 383 void SearchBox::OnHistorySyncCheckResult(bool sync_history) { |
| 384 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { |
| 385 extensions_v8::SearchBoxExtension::DispatchHistorySyncCheckResult( |
| 386 render_view()->GetWebView()->mainFrame(), sync_history); |
| 387 } |
| 388 } |
| 389 |
376 void SearchBox::OnMarginChange(int margin) { | 390 void SearchBox::OnMarginChange(int margin) { |
377 start_margin_ = margin; | 391 start_margin_ = margin; |
378 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { | 392 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { |
379 extensions_v8::SearchBoxExtension::DispatchMarginChange( | 393 extensions_v8::SearchBoxExtension::DispatchMarginChange( |
380 render_view()->GetWebView()->mainFrame()); | 394 render_view()->GetWebView()->mainFrame()); |
381 } | 395 } |
382 } | 396 } |
383 | 397 |
384 void SearchBox::OnMostVisitedChanged( | 398 void SearchBox::OnMostVisitedChanged( |
385 const std::vector<InstantMostVisitedItem>& items) { | 399 const std::vector<InstantMostVisitedItem>& items) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 | 483 |
470 void SearchBox::Reset() { | 484 void SearchBox::Reset() { |
471 query_.clear(); | 485 query_.clear(); |
472 embedded_search_request_params_ = EmbeddedSearchRequestParams(); | 486 embedded_search_request_params_ = EmbeddedSearchRequestParams(); |
473 suggestion_ = InstantSuggestion(); | 487 suggestion_ = InstantSuggestion(); |
474 start_margin_ = 0; | 488 start_margin_ = 0; |
475 is_focused_ = false; | 489 is_focused_ = false; |
476 is_key_capture_enabled_ = false; | 490 is_key_capture_enabled_ = false; |
477 theme_info_ = ThemeBackgroundInfo(); | 491 theme_info_ = ThemeBackgroundInfo(); |
478 } | 492 } |
OLD | NEW |