| 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/cocoa/browser_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #import "base/mac/sdk_forward_declarations.h" | 10 #import "base/mac/sdk_forward_declarations.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 14 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/download/download_shelf.h" | 16 #include "chrome/browser/download/download_shelf.h" |
| 17 #include "chrome/browser/extensions/extension_util.h" | 17 #include "chrome/browser/extensions/extension_util.h" |
| 18 #include "chrome/browser/extensions/tab_helper.h" | 18 #include "chrome/browser/extensions/tab_helper.h" |
| 19 #include "chrome/browser/metrics/browser_window_histogram_helper.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/profiles/profile_window.h" | 21 #include "chrome/browser/profiles/profile_window.h" |
| 21 #include "chrome/browser/shell_integration.h" | 22 #include "chrome/browser/shell_integration.h" |
| 22 #include "chrome/browser/signin/chrome_signin_helper.h" | 23 #include "chrome/browser/signin/chrome_signin_helper.h" |
| 23 #include "chrome/browser/translate/chrome_translate_client.h" | 24 #include "chrome/browser/translate/chrome_translate_client.h" |
| 24 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
| 25 #include "chrome/browser/ui/browser_command_controller.h" | 26 #include "chrome/browser/ui/browser_command_controller.h" |
| 26 #include "chrome/browser/ui/browser_commands.h" | 27 #include "chrome/browser/ui/browser_commands.h" |
| 27 #include "chrome/browser/ui/browser_dialogs.h" | 28 #include "chrome/browser/ui/browser_dialogs.h" |
| 28 #include "chrome/browser/ui/browser_list.h" | 29 #include "chrome/browser/ui/browser_list.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 saved_animation_behavior = [window() animationBehavior]; | 169 saved_animation_behavior = [window() animationBehavior]; |
| 169 [window() setAnimationBehavior:NSWindowAnimationBehaviorNone]; | 170 [window() setAnimationBehavior:NSWindowAnimationBehaviorNone]; |
| 170 } | 171 } |
| 171 | 172 |
| 172 { | 173 { |
| 173 TRACE_EVENT0("ui", "BrowserWindowCocoa::Show makeKeyAndOrderFront"); | 174 TRACE_EVENT0("ui", "BrowserWindowCocoa::Show makeKeyAndOrderFront"); |
| 174 // This call takes up a substantial part of startup time, and an even more | 175 // This call takes up a substantial part of startup time, and an even more |
| 175 // substantial part of startup time when any CALayers are part of the | 176 // substantial part of startup time when any CALayers are part of the |
| 176 // window's NSView heirarchy. | 177 // window's NSView heirarchy. |
| 177 [window() makeKeyAndOrderFront:controller_]; | 178 [window() makeKeyAndOrderFront:controller_]; |
| 179 |
| 180 // At this point all the Browser's UI is painted on the screen. There's no |
| 181 // need to wait for the compositor, so pass the nullptr instead. |
| 182 BrowserWindowHistogramHelper::OnBrowserPainted(nullptr); |
| 178 } | 183 } |
| 179 | 184 |
| 180 // When creating windows from nibs it is necessary to |makeKeyAndOrderFront:| | 185 // When creating windows from nibs it is necessary to |makeKeyAndOrderFront:| |
| 181 // prior to |orderOut:| then |miniaturize:| when restoring windows in the | 186 // prior to |orderOut:| then |miniaturize:| when restoring windows in the |
| 182 // minimized state. | 187 // minimized state. |
| 183 if (initial_show_state_ == ui::SHOW_STATE_MINIMIZED) { | 188 if (initial_show_state_ == ui::SHOW_STATE_MINIMIZED) { |
| 184 [window() orderOut:controller_]; | 189 [window() orderOut:controller_]; |
| 185 [window() miniaturize:controller_]; | 190 [window() miniaturize:controller_]; |
| 186 } else if (initial_show_state_ == ui::SHOW_STATE_FULLSCREEN) { | 191 } else if (initial_show_state_ == ui::SHOW_STATE_FULLSCREEN) { |
| 187 chrome::ToggleFullscreenMode(browser_); | 192 chrome::ToggleFullscreenMode(browser_); |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 ExclusiveAccessContext* BrowserWindowCocoa::GetExclusiveAccessContext() { | 856 ExclusiveAccessContext* BrowserWindowCocoa::GetExclusiveAccessContext() { |
| 852 return [controller_ exclusiveAccessController]; | 857 return [controller_ exclusiveAccessController]; |
| 853 } | 858 } |
| 854 | 859 |
| 855 void BrowserWindowCocoa::ShowImeWarningBubble( | 860 void BrowserWindowCocoa::ShowImeWarningBubble( |
| 856 const extensions::Extension* extension, | 861 const extensions::Extension* extension, |
| 857 const base::Callback<void(ImeWarningBubblePermissionStatus status)>& | 862 const base::Callback<void(ImeWarningBubblePermissionStatus status)>& |
| 858 callback) { | 863 callback) { |
| 859 NOTREACHED() << "The IME warning bubble is unsupported on this platform."; | 864 NOTREACHED() << "The IME warning bubble is unsupported on this platform."; |
| 860 } | 865 } |
| OLD | NEW |