Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: chrome/renderer/searchbox/searchbox.cc

Issue 1025613005: Fix SearchBox::LogEvent for out-of-process iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 display_instant_results_(false), 153 display_instant_results_(false),
154 most_visited_items_cache_(kMaxInstantMostVisitedItemCacheSize), 154 most_visited_items_cache_(kMaxInstantMostVisitedItemCacheSize),
155 query_(), 155 query_(),
156 start_margin_(0) { 156 start_margin_(0) {
157 } 157 }
158 158
159 SearchBox::~SearchBox() { 159 SearchBox::~SearchBox() {
160 } 160 }
161 161
162 void SearchBox::LogEvent(NTPLoggingEventType event) { 162 void SearchBox::LogEvent(NTPLoggingEventType event) {
163 // navigation_start in ms. 163 base::TimeDelta delta;
Charlie Reis 2015/03/20 21:37:52 nit: Put below the comment.
alexmos 2015/03/20 21:50:57 Done.
164 uint64 start = 1000 * (render_view()->GetMainRenderFrame()->GetWebFrame()-> 164 // The main frame for the current RenderView may be out-of-process, in which
165 performance().navigationStart()); 165 // case it won't have navigationStart(). Use a delta of 0 in this case.
Charlie Reis 2015/03/20 21:37:52 s/navigationStart()/performance()/ Also, "Use the
alexmos 2015/03/20 21:50:57 Done.
166 uint64 now = 166 if (!render_view()->GetWebView()->mainFrame()->isWebRemoteFrame()) {
Charlie Reis 2015/03/20 21:37:52 Is there a reason to do !isWebRemoteFrame() rather
alexmos 2015/03/20 21:50:57 Thanks, fixed. Just forgot to switch it around.
167 (base::TimeTicks::Now() - base::TimeTicks::UnixEpoch()).InMilliseconds(); 167 // navigation_start in ms.
168 DCHECK(now >= start); 168 uint64 start = 1000 * (render_view()->GetMainRenderFrame()->GetWebFrame()->
169 base::TimeDelta delta = base::TimeDelta::FromMilliseconds(now - start); 169 performance().navigationStart());
170 uint64 now = (base::TimeTicks::Now() - base::TimeTicks::UnixEpoch())
171 .InMilliseconds();
172 DCHECK(now >= start);
173 delta = base::TimeDelta::FromMilliseconds(now - start);
174 }
170 render_view()->Send(new ChromeViewHostMsg_LogEvent( 175 render_view()->Send(new ChromeViewHostMsg_LogEvent(
171 render_view()->GetRoutingID(), page_seq_no_, event, delta)); 176 render_view()->GetRoutingID(), page_seq_no_, event, delta));
172 } 177 }
173 178
174 void SearchBox::LogMostVisitedImpression(int position, 179 void SearchBox::LogMostVisitedImpression(int position,
175 const base::string16& provider) { 180 const base::string16& provider) {
176 render_view()->Send(new ChromeViewHostMsg_LogMostVisitedImpression( 181 render_view()->Send(new ChromeViewHostMsg_LogMostVisitedImpression(
177 render_view()->GetRoutingID(), page_seq_no_, position, provider)); 182 render_view()->GetRoutingID(), page_seq_no_, position, provider));
178 } 183 }
179 184
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 499
495 void SearchBox::Reset() { 500 void SearchBox::Reset() {
496 query_.clear(); 501 query_.clear();
497 embedded_search_request_params_ = EmbeddedSearchRequestParams(); 502 embedded_search_request_params_ = EmbeddedSearchRequestParams();
498 suggestion_ = InstantSuggestion(); 503 suggestion_ = InstantSuggestion();
499 start_margin_ = 0; 504 start_margin_ = 0;
500 is_focused_ = false; 505 is_focused_ = false;
501 is_key_capture_enabled_ = false; 506 is_key_capture_enabled_ = false;
502 theme_info_ = ThemeBackgroundInfo(); 507 theme_info_ = ThemeBackgroundInfo();
503 } 508 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698