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

Side by Side Diff: chrome/browser/dom_ui/new_tab_ui.cc

Issue 28046: Use string for Histogram names since these are all ASCII anyway wide-characte... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chrome_plugin_host.cc ('k') | chrome/browser/history/history_backend.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/browser/dom_ui/new_tab_ui.h" 5 #include "chrome/browser/dom_ui/new_tab_ui.h"
6 6
7 #include "base/histogram.h" 7 #include "base/histogram.h"
8 #include "base/string_piece.h" 8 #include "base/string_piece.h"
9 #include "chrome/browser/bookmarks/bookmark_utils.h" 9 #include "chrome/browser/bookmarks/bookmark_utils.h"
10 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 void Timeout() { 83 void Timeout() {
84 base::TimeTicks now = base::TimeTicks::Now(); 84 base::TimeTicks now = base::TimeTicks::Now();
85 if ((now - last_paint_) >= base::TimeDelta::FromMilliseconds(kTimeoutMs)) { 85 if ((now - last_paint_) >= base::TimeDelta::FromMilliseconds(kTimeoutMs)) {
86 // Painting has quieted down. Log this as the full time to run. 86 // Painting has quieted down. Log this as the full time to run.
87 base::TimeDelta load_time = last_paint_ - start_; 87 base::TimeDelta load_time = last_paint_ - start_;
88 int load_time_ms = static_cast<int>(load_time.InMilliseconds()); 88 int load_time_ms = static_cast<int>(load_time.InMilliseconds());
89 NotificationService::current()->Notify( 89 NotificationService::current()->Notify(
90 NotificationType::INITIAL_NEW_TAB_UI_LOAD, 90 NotificationType::INITIAL_NEW_TAB_UI_LOAD,
91 NotificationService::AllSources(), 91 NotificationService::AllSources(),
92 Details<int>(&load_time_ms)); 92 Details<int>(&load_time_ms));
93 UMA_HISTOGRAM_TIMES(L"NewTabUI load", load_time); 93 UMA_HISTOGRAM_TIMES("NewTabUI load", load_time);
94 } else { 94 } else {
95 // Not enough quiet time has elapsed. 95 // Not enough quiet time has elapsed.
96 // Some more paints must've occurred since we set the timeout. 96 // Some more paints must've occurred since we set the timeout.
97 // Wait some more. 97 // Wait some more.
98 MessageLoop::current()->PostDelayedTask(FROM_HERE, 98 MessageLoop::current()->PostDelayedTask(FROM_HERE,
99 method_factory_.NewRunnableMethod(&PaintTimer::Timeout), kTimeoutMs); 99 method_factory_.NewRunnableMethod(&PaintTimer::Timeout), kTimeoutMs);
100 } 100 }
101 } 101 }
102 102
103 private: 103 private:
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 DictionaryValue* entry_value = new DictionaryValue; 473 DictionaryValue* entry_value = new DictionaryValue;
474 entry_value->SetString(L"short_name", urls[i]->short_name()); 474 entry_value->SetString(L"short_name", urls[i]->short_name());
475 entry_value->SetString(L"keyword", urls[i]->keyword()); 475 entry_value->SetString(L"keyword", urls[i]->keyword());
476 476
477 const GURL& url = urls[i]->GetFavIconURL(); 477 const GURL& url = urls[i]->GetFavIconURL();
478 if (url.is_valid()) 478 if (url.is_valid())
479 entry_value->SetString(L"favIconURL", UTF8ToWide(url.spec())); 479 entry_value->SetString(L"favIconURL", UTF8ToWide(url.spec()));
480 480
481 urls_value.Append(entry_value); 481 urls_value.Append(entry_value);
482 } 482 }
483 UMA_HISTOGRAM_COUNTS(L"NewTabPage.SearchURLs.Total", urls_value.GetSize()); 483 UMA_HISTOGRAM_COUNTS("NewTabPage.SearchURLs.Total", urls_value.GetSize());
484 dom_ui_host_->CallJavascriptFunction(L"searchURLs", urls_value); 484 dom_ui_host_->CallJavascriptFunction(L"searchURLs", urls_value);
485 } 485 }
486 486
487 /////////////////////////////////////////////////////////////////////////////// 487 ///////////////////////////////////////////////////////////////////////////////
488 // RecentlyBookmarkedHandler 488 // RecentlyBookmarkedHandler
489 489
490 RecentlyBookmarkedHandler::RecentlyBookmarkedHandler(DOMUIHost* dom_ui_host) 490 RecentlyBookmarkedHandler::RecentlyBookmarkedHandler(DOMUIHost* dom_ui_host)
491 : dom_ui_host_(dom_ui_host), 491 : dom_ui_host_(dom_ui_host),
492 model_(NULL) { 492 model_(NULL) {
493 dom_ui_host->RegisterMessageCallback("getRecentlyBookmarked", 493 dom_ui_host->RegisterMessageCallback("getRecentlyBookmarked",
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 void NewTabUIContents::RequestOpenURL(const GURL& url, 882 void NewTabUIContents::RequestOpenURL(const GURL& url,
883 const GURL& /*referrer*/, 883 const GURL& /*referrer*/,
884 WindowOpenDisposition disposition) { 884 WindowOpenDisposition disposition) {
885 // The user opened a URL on the page (including "open in new window"). 885 // The user opened a URL on the page (including "open in new window").
886 // We count all such clicks as AUTO_BOOKMARK, which increments the site's 886 // We count all such clicks as AUTO_BOOKMARK, which increments the site's
887 // visit count (which is used for ranking the most visited entries). 887 // visit count (which is used for ranking the most visited entries).
888 // Note this means we're including clicks on not only most visited thumbnails, 888 // Note this means we're including clicks on not only most visited thumbnails,
889 // but also clicks on recently bookmarked. 889 // but also clicks on recently bookmarked.
890 OpenURL(url, GURL(), disposition, PageTransition::AUTO_BOOKMARK); 890 OpenURL(url, GURL(), disposition, PageTransition::AUTO_BOOKMARK);
891 } 891 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_plugin_host.cc ('k') | chrome/browser/history/history_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698