OLD | NEW |
---|---|
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 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1971 | 1972 |
1972 bool Browser::IsMouseLocked() const { | 1973 bool Browser::IsMouseLocked() const { |
1973 return fullscreen_controller_->IsMouseLocked(); | 1974 return fullscreen_controller_->IsMouseLocked(); |
1974 } | 1975 } |
1975 | 1976 |
1976 void Browser::OnWindowDidShow() { | 1977 void Browser::OnWindowDidShow() { |
1977 if (window_has_shown_) | 1978 if (window_has_shown_) |
1978 return; | 1979 return; |
1979 window_has_shown_ = true; | 1980 window_has_shown_ = true; |
1980 | 1981 |
1982 // CurrentProcessInfo::CreationTime() is currently only implemented on Mac and | |
1983 // Windows. | |
1984 #if defined(OS_MACOSX) || defined(OS_WIN) | |
sky
2012/06/26 16:14:15
Aren't there a number of code paths that could res
| |
1985 // Measure the latency from startup till the first browser window becomes | |
1986 // visible. | |
1987 static bool isFirstBrowserWindow = true; | |
1988 if (isFirstBrowserWindow) { | |
1989 isFirstBrowserWindow = false; | |
1990 const base::Time* process_creation_time = | |
1991 base::CurrentProcessInfo::CreationTime(); | |
1992 | |
1993 if (process_creation_time) { | |
1994 UMA_HISTOGRAM_LONG_TIMES( | |
1995 "Startup.BrowserWindowDisplay", | |
1996 base::Time::Now() - *process_creation_time); | |
1997 } | |
1998 } | |
1999 #endif // OS_MACOSX || OS_WIN | |
2000 | |
1981 // Nothing to do for non-tabbed windows. | 2001 // Nothing to do for non-tabbed windows. |
1982 if (!is_type_tabbed()) | 2002 if (!is_type_tabbed()) |
1983 return; | 2003 return; |
1984 | 2004 |
1985 // Show any pending global error bubble. | 2005 // Show any pending global error bubble. |
1986 GlobalErrorService* service = | 2006 GlobalErrorService* service = |
1987 GlobalErrorServiceFactory::GetForProfile(profile()); | 2007 GlobalErrorServiceFactory::GetForProfile(profile()); |
1988 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 2008 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
1989 if (error) | 2009 if (error) |
1990 error->ShowBubbleView(this); | 2010 error->ShowBubbleView(this); |
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3899 if (contents && !allow_js_access) { | 3919 if (contents && !allow_js_access) { |
3900 contents->web_contents()->GetController().LoadURL( | 3920 contents->web_contents()->GetController().LoadURL( |
3901 target_url, | 3921 target_url, |
3902 content::Referrer(), | 3922 content::Referrer(), |
3903 content::PAGE_TRANSITION_LINK, | 3923 content::PAGE_TRANSITION_LINK, |
3904 std::string()); // No extra headers. | 3924 std::string()); // No extra headers. |
3905 } | 3925 } |
3906 | 3926 |
3907 return contents != NULL; | 3927 return contents != NULL; |
3908 } | 3928 } |
OLD | NEW |