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

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 10662046: Add a histogram to measure browser window display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Spelling Created 8 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/browser/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
11 11
12 #include <algorithm> 12 #include <algorithm>
13 #include <string> 13 #include <string>
14 14
15 #include "base/base_paths.h" 15 #include "base/base_paths.h"
16 #include "base/bind.h" 16 #include "base/bind.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/metrics/field_trial.h" 19 #include "base/metrics/field_trial.h"
20 #include "base/metrics/histogram.h" 20 #include "base/metrics/histogram.h"
21 #include "base/path_service.h" 21 #include "base/path_service.h"
22 #include "base/process_info.h"
22 #include "base/string_number_conversions.h" 23 #include "base/string_number_conversions.h"
23 #include "base/string_util.h" 24 #include "base/string_util.h"
24 #include "base/stringprintf.h" 25 #include "base/stringprintf.h"
25 #include "base/threading/thread.h" 26 #include "base/threading/thread.h"
26 #include "base/threading/thread_restrictions.h" 27 #include "base/threading/thread_restrictions.h"
27 #include "base/time.h" 28 #include "base/time.h"
28 #include "base/utf_string_conversions.h" 29 #include "base/utf_string_conversions.h"
29 #include "chrome/app/chrome_command_ids.h" 30 #include "chrome/app/chrome_command_ids.h"
30 #include "chrome/browser/autofill/personal_data_manager_factory.h" 31 #include "chrome/browser/autofill/personal_data_manager_factory.h"
31 #include "chrome/browser/background/background_contents_service.h" 32 #include "chrome/browser/background/background_contents_service.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 #include "chrome/browser/upgrade_detector.h" 146 #include "chrome/browser/upgrade_detector.h"
146 #include "chrome/browser/web_applications/web_app.h" 147 #include "chrome/browser/web_applications/web_app.h"
147 #include "chrome/common/chrome_constants.h" 148 #include "chrome/common/chrome_constants.h"
148 #include "chrome/common/chrome_notification_types.h" 149 #include "chrome/common/chrome_notification_types.h"
149 #include "chrome/common/chrome_switches.h" 150 #include "chrome/common/chrome_switches.h"
150 #include "chrome/common/custom_handlers/protocol_handler.h" 151 #include "chrome/common/custom_handlers/protocol_handler.h"
151 #include "chrome/common/extensions/extension.h" 152 #include "chrome/common/extensions/extension.h"
152 #include "chrome/common/extensions/extension_constants.h" 153 #include "chrome/common/extensions/extension_constants.h"
153 #include "chrome/common/pref_names.h" 154 #include "chrome/common/pref_names.h"
154 #include "chrome/common/profiling.h" 155 #include "chrome/common/profiling.h"
156 #include "chrome/common/startup_metric_utils.h"
155 #include "chrome/common/url_constants.h" 157 #include "chrome/common/url_constants.h"
156 #include "chrome/common/web_apps.h" 158 #include "chrome/common/web_apps.h"
157 #include "content/public/browser/color_chooser.h" 159 #include "content/public/browser/color_chooser.h"
158 #include "content/public/browser/devtools_manager.h" 160 #include "content/public/browser/devtools_manager.h"
159 #include "content/public/browser/download_item.h" 161 #include "content/public/browser/download_item.h"
160 #include "content/public/browser/download_manager.h" 162 #include "content/public/browser/download_manager.h"
161 #include "content/public/browser/interstitial_page.h" 163 #include "content/public/browser/interstitial_page.h"
162 #include "content/public/browser/invalidate_type.h" 164 #include "content/public/browser/invalidate_type.h"
163 #include "content/public/browser/navigation_controller.h" 165 #include "content/public/browser/navigation_controller.h"
164 #include "content/public/browser/navigation_entry.h" 166 #include "content/public/browser/navigation_entry.h"
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 1194
1193 bool Browser::IsMouseLocked() const { 1195 bool Browser::IsMouseLocked() const {
1194 return fullscreen_controller_->IsMouseLocked(); 1196 return fullscreen_controller_->IsMouseLocked();
1195 } 1197 }
1196 1198
1197 void Browser::OnWindowDidShow() { 1199 void Browser::OnWindowDidShow() {
1198 if (window_has_shown_) 1200 if (window_has_shown_)
1199 return; 1201 return;
1200 window_has_shown_ = true; 1202 window_has_shown_ = true;
1201 1203
1204 // CurrentProcessInfo::CreationTime() is currently only implemented on Mac and
1205 // Windows.
1206 #if defined(OS_MACOSX) || defined(OS_WIN)
1207 // Measure the latency from startup till the first browser window becomes
1208 // visible.
1209 static bool is_first_browser_window = true;
1210 if (is_first_browser_window &&
1211 !startup_metric_utils::WasNonBrowserUIDisplayed()) {
1212 is_first_browser_window = false;
1213 const base::Time* process_creation_time =
1214 base::CurrentProcessInfo::CreationTime();
1215
1216 if (process_creation_time) {
1217 UMA_HISTOGRAM_LONG_TIMES(
1218 "Startup.BrowserWindowDisplay",
1219 base::Time::Now() - *process_creation_time);
1220 }
1221 }
1222 #endif // OS_MACOSX || OS_WIN
1223
1202 // Nothing to do for non-tabbed windows. 1224 // Nothing to do for non-tabbed windows.
1203 if (!is_type_tabbed()) 1225 if (!is_type_tabbed())
1204 return; 1226 return;
1205 1227
1206 // Show any pending global error bubble. 1228 // Show any pending global error bubble.
1207 GlobalErrorService* service = 1229 GlobalErrorService* service =
1208 GlobalErrorServiceFactory::GetForProfile(profile()); 1230 GlobalErrorServiceFactory::GetForProfile(profile());
1209 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); 1231 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView();
1210 if (error) 1232 if (error)
1211 error->ShowBubbleView(this); 1233 error->ShowBubbleView(this);
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
2271 if (contents && !allow_js_access) { 2293 if (contents && !allow_js_access) {
2272 contents->web_contents()->GetController().LoadURL( 2294 contents->web_contents()->GetController().LoadURL(
2273 target_url, 2295 target_url,
2274 content::Referrer(), 2296 content::Referrer(),
2275 content::PAGE_TRANSITION_LINK, 2297 content::PAGE_TRANSITION_LINK,
2276 std::string()); // No extra headers. 2298 std::string()); // No extra headers.
2277 } 2299 }
2278 2300
2279 return contents != NULL; 2301 return contents != NULL;
2280 } 2302 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/simple_message_box_mac.mm » ('j') | chrome/common/startup_metric_utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698