| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 SearchBox::SearchBox(content::RenderFrame* render_frame) | 237 SearchBox::SearchBox(content::RenderFrame* render_frame) |
| 238 : content::RenderFrameObserver(render_frame), | 238 : content::RenderFrameObserver(render_frame), |
| 239 content::RenderFrameObserverTracker<SearchBox>(render_frame), | 239 content::RenderFrameObserverTracker<SearchBox>(render_frame), |
| 240 page_seq_no_(0), | 240 page_seq_no_(0), |
| 241 is_focused_(false), | 241 is_focused_(false), |
| 242 is_input_in_progress_(false), | 242 is_input_in_progress_(false), |
| 243 is_key_capture_enabled_(false), | 243 is_key_capture_enabled_(false), |
| 244 most_visited_items_cache_(kMaxInstantMostVisitedItemCacheSize), | 244 most_visited_items_cache_(kMaxInstantMostVisitedItemCacheSize), |
| 245 query_(), | 245 query_(), |
| 246 binding_(this) { | 246 binding_(this) { |
| 247 render_frame->GetRemoteAssociatedInterfaces()->GetInterface( | 247 // Connect to the NTP interface in the browser. |
| 248 &instant_service_); | 248 chrome::mojom::NTPConnectorAssociatedPtr ntp_connector; |
| 249 render_frame->GetAssociatedInterfaceRegistry()->AddInterface( | 249 render_frame->GetRemoteAssociatedInterfaces()->GetInterface(&ntp_connector); |
| 250 base::Bind(&SearchBox::Bind, base::Unretained(this))); | 250 chrome::mojom::SearchBoxAssociatedPtrInfo search_box; |
| 251 binding_.Bind(&search_box, ntp_connector.associated_group()); |
| 252 ntp_connector->Connect( |
| 253 mojo::MakeRequest(&instant_service_, ntp_connector.associated_group()), |
| 254 std::move(search_box)); |
| 251 } | 255 } |
| 252 | 256 |
| 253 SearchBox::~SearchBox() { | 257 SearchBox::~SearchBox() { |
| 254 } | 258 } |
| 255 | 259 |
| 256 void SearchBox::LogEvent(NTPLoggingEventType event) { | 260 void SearchBox::LogEvent(NTPLoggingEventType event) { |
| 257 // navigation_start in ms. | 261 // navigation_start in ms. |
| 258 uint64_t start = | 262 uint64_t start = |
| 259 1000 * (render_frame()->GetWebFrame()->performance().navigationStart()); | 263 1000 * (render_frame()->GetWebFrame()->performance().navigationStart()); |
| 260 uint64_t now = | 264 uint64_t now = |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 embedded_search_request_params_ = EmbeddedSearchRequestParams(); | 463 embedded_search_request_params_ = EmbeddedSearchRequestParams(); |
| 460 suggestion_ = InstantSuggestion(); | 464 suggestion_ = InstantSuggestion(); |
| 461 is_focused_ = false; | 465 is_focused_ = false; |
| 462 is_key_capture_enabled_ = false; | 466 is_key_capture_enabled_ = false; |
| 463 theme_info_ = ThemeBackgroundInfo(); | 467 theme_info_ = ThemeBackgroundInfo(); |
| 464 } | 468 } |
| 465 | 469 |
| 466 void SearchBox::OnDestruct() { | 470 void SearchBox::OnDestruct() { |
| 467 delete this; | 471 delete this; |
| 468 } | 472 } |
| OLD | NEW |