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

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: Improve code comments Created 8 years, 4 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 | « no previous file | chrome/browser/ui/cocoa/simple_message_box_mac.mm » ('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) 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 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 1190
1189 bool Browser::IsMouseLocked() const { 1191 bool Browser::IsMouseLocked() const {
1190 return fullscreen_controller_->IsMouseLocked(); 1192 return fullscreen_controller_->IsMouseLocked();
1191 } 1193 }
1192 1194
1193 void Browser::OnWindowDidShow() { 1195 void Browser::OnWindowDidShow() {
1194 if (window_has_shown_) 1196 if (window_has_shown_)
1195 return; 1197 return;
1196 window_has_shown_ = true; 1198 window_has_shown_ = true;
1197 1199
1200 // CurrentProcessInfo::CreationTime() is currently only implemented on Mac and
1201 // Windows.
1202 #if defined(OS_MACOSX) || defined(OS_WIN)
1203 // Measure the latency from startup till the first browser window becomes
1204 // visible.
1205 static bool is_first_browser_window = true;
1206 if (is_first_browser_window &&
1207 !startup_metric_utils::WasNonBrowserUIDisplayed()) {
1208 is_first_browser_window = false;
1209 const base::Time* process_creation_time =
1210 base::CurrentProcessInfo::CreationTime();
1211
1212 if (process_creation_time) {
1213 UMA_HISTOGRAM_LONG_TIMES(
1214 "Startup.BrowserWindowDisplay",
1215 base::Time::Now() - *process_creation_time);
1216 }
1217 }
1218 #endif // OS_MACOSX || OS_WIN
1219
1198 // Nothing to do for non-tabbed windows. 1220 // Nothing to do for non-tabbed windows.
1199 if (!is_type_tabbed()) 1221 if (!is_type_tabbed())
1200 return; 1222 return;
1201 1223
1202 // Show any pending global error bubble. 1224 // Show any pending global error bubble.
1203 GlobalErrorService* service = 1225 GlobalErrorService* service =
1204 GlobalErrorServiceFactory::GetForProfile(profile()); 1226 GlobalErrorServiceFactory::GetForProfile(profile());
1205 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); 1227 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView();
1206 if (error) 1228 if (error)
1207 error->ShowBubbleView(this); 1229 error->ShowBubbleView(this);
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
2267 if (contents && !allow_js_access) { 2289 if (contents && !allow_js_access) {
2268 contents->web_contents()->GetController().LoadURL( 2290 contents->web_contents()->GetController().LoadURL(
2269 target_url, 2291 target_url,
2270 content::Referrer(), 2292 content::Referrer(),
2271 content::PAGE_TRANSITION_LINK, 2293 content::PAGE_TRANSITION_LINK,
2272 std::string()); // No extra headers. 2294 std::string()); // No extra headers.
2273 } 2295 }
2274 2296
2275 return contents != NULL; 2297 return contents != NULL;
2276 } 2298 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/simple_message_box_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698