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> |
| 8 #include <stdint.h> |
| 9 |
7 #include <string> | 10 #include <string> |
8 | 11 |
9 #include "base/logging.h" | 12 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
12 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
14 #include "base/time/time.h" | 17 #include "base/time/time.h" |
15 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
16 #include "chrome/common/render_messages.h" | 19 #include "chrome/common/render_messages.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 SearchBox::~SearchBox() { | 248 SearchBox::~SearchBox() { |
246 } | 249 } |
247 | 250 |
248 void SearchBox::LogEvent(NTPLoggingEventType event) { | 251 void SearchBox::LogEvent(NTPLoggingEventType event) { |
249 // The main frame for the current RenderView may be out-of-process, in which | 252 // The main frame for the current RenderView may be out-of-process, in which |
250 // case it won't have performance(). Use the default delta of 0 in this | 253 // case it won't have performance(). Use the default delta of 0 in this |
251 // case. | 254 // case. |
252 base::TimeDelta delta; | 255 base::TimeDelta delta; |
253 if (render_view()->GetWebView()->mainFrame()->isWebLocalFrame()) { | 256 if (render_view()->GetWebView()->mainFrame()->isWebLocalFrame()) { |
254 // navigation_start in ms. | 257 // navigation_start in ms. |
255 uint64 start = 1000 * (render_view()->GetMainRenderFrame()->GetWebFrame()-> | 258 uint64_t start = 1000 * (render_view() |
256 performance().navigationStart()); | 259 ->GetMainRenderFrame() |
257 uint64 now = (base::TimeTicks::Now() - base::TimeTicks::UnixEpoch()) | 260 ->GetWebFrame() |
258 .InMilliseconds(); | 261 ->performance() |
| 262 .navigationStart()); |
| 263 uint64_t now = (base::TimeTicks::Now() - base::TimeTicks::UnixEpoch()) |
| 264 .InMilliseconds(); |
259 DCHECK(now >= start); | 265 DCHECK(now >= start); |
260 delta = base::TimeDelta::FromMilliseconds(now - start); | 266 delta = base::TimeDelta::FromMilliseconds(now - start); |
261 } | 267 } |
262 render_view()->Send(new ChromeViewHostMsg_LogEvent( | 268 render_view()->Send(new ChromeViewHostMsg_LogEvent( |
263 render_view()->GetRoutingID(), page_seq_no_, event, delta)); | 269 render_view()->GetRoutingID(), page_seq_no_, event, delta)); |
264 } | 270 } |
265 | 271 |
266 void SearchBox::LogMostVisitedImpression(int position, | 272 void SearchBox::LogMostVisitedImpression(int position, |
267 const base::string16& provider) { | 273 const base::string16& provider) { |
268 render_view()->Send(new ChromeViewHostMsg_LogMostVisitedImpression( | 274 render_view()->Send(new ChromeViewHostMsg_LogMostVisitedImpression( |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 | 549 |
544 void SearchBox::Reset() { | 550 void SearchBox::Reset() { |
545 query_.clear(); | 551 query_.clear(); |
546 embedded_search_request_params_ = EmbeddedSearchRequestParams(); | 552 embedded_search_request_params_ = EmbeddedSearchRequestParams(); |
547 suggestion_ = InstantSuggestion(); | 553 suggestion_ = InstantSuggestion(); |
548 start_margin_ = 0; | 554 start_margin_ = 0; |
549 is_focused_ = false; | 555 is_focused_ = false; |
550 is_key_capture_enabled_ = false; | 556 is_key_capture_enabled_ = false; |
551 theme_info_ = ThemeBackgroundInfo(); | 557 theme_info_ = ThemeBackgroundInfo(); |
552 } | 558 } |
OLD | NEW |