OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/profiles/user_manager_mac.h" | 5 #include "chrome/browser/ui/cocoa/profiles/user_manager_mac.h" |
6 | 6 |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
10 #include "chrome/browser/ui/browser_dialogs.h" | 10 #include "chrome/browser/ui/browser_dialogs.h" |
11 #import "chrome/browser/ui/cocoa/browser_window_utils.h" | 11 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
12 #include "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 12 #include "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
13 #include "content/public/browser/native_web_keyboard_event.h" | 13 #include "content/public/browser/native_web_keyboard_event.h" |
14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
15 #include "content/public/browser/web_contents_delegate.h" | 15 #include "content/public/browser/web_contents_delegate.h" |
16 #include "grit/chromium_strings.h" | |
16 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
msw
2014/08/04 20:17:55
You can remove this now, right?
noms (inactive)
2014/08/06 18:41:24
Done.
| |
17 #include "ui/base/l10n/l10n_util_mac.h" | 18 #include "ui/base/l10n/l10n_util_mac.h" |
18 | 19 |
19 // Default window size. Taken from the views implementation in | 20 // Default window size. Taken from the views implementation in |
20 // chrome/browser/ui/views/user_manager_view.cc. | 21 // chrome/browser/ui/views/user_manager_view.cc. |
21 // TODO(noms): Figure out if this size can be computed dynamically or adjusted | 22 // TODO(noms): Figure out if this size can be computed dynamically or adjusted |
22 // for smaller screens. | 23 // for smaller screens. |
23 const int kWindowWidth = 900; | 24 const int kWindowWidth = 900; |
24 const int kWindowHeight = 700; | 25 const int kWindowHeight = 700; |
25 | 26 |
26 namespace chrome { | 27 namespace chrome { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 NSRect contentRect = NSMakeRect((screenWidth - kWindowWidth) / 2, | 102 NSRect contentRect = NSMakeRect((screenWidth - kWindowWidth) / 2, |
102 (screenHeight - kWindowHeight) / 2, | 103 (screenHeight - kWindowHeight) / 2, |
103 kWindowWidth, kWindowHeight); | 104 kWindowWidth, kWindowHeight); |
104 ChromeEventProcessingWindow* window = [[ChromeEventProcessingWindow alloc] | 105 ChromeEventProcessingWindow* window = [[ChromeEventProcessingWindow alloc] |
105 initWithContentRect:contentRect | 106 initWithContentRect:contentRect |
106 styleMask:NSTitledWindowMask | | 107 styleMask:NSTitledWindowMask | |
107 NSClosableWindowMask | | 108 NSClosableWindowMask | |
108 NSResizableWindowMask | 109 NSResizableWindowMask |
109 backing:NSBackingStoreBuffered | 110 backing:NSBackingStoreBuffered |
110 defer:NO]; | 111 defer:NO]; |
111 [window setTitle:l10n_util::GetNSString(IDS_USER_MANAGER_SCREEN_TITLE)]; | 112 [window setTitle:l10n_util::GetNSString(IDS_PRODUCT_NAME)]; |
112 [window setMinSize:NSMakeSize(kWindowWidth, kWindowHeight)]; | 113 [window setMinSize:NSMakeSize(kWindowWidth, kWindowHeight)]; |
113 | 114 |
114 if ((self = [super initWithWindow:window])) { | 115 if ((self = [super initWithWindow:window])) { |
115 userManagerObserver_ = userManagerObserver; | 116 userManagerObserver_ = userManagerObserver; |
116 | 117 |
117 // Initialize the web view. | 118 // Initialize the web view. |
118 webContents_.reset(content::WebContents::Create( | 119 webContents_.reset(content::WebContents::Create( |
119 content::WebContents::CreateParams(profile))); | 120 content::WebContents::CreateParams(profile))); |
120 window.contentView = webContents_->GetNativeView(); | 121 window.contentView = webContents_->GetNativeView(); |
121 webContentsDelegate_.reset(new UserManagerWebContentsDelegate(window)); | 122 webContentsDelegate_.reset(new UserManagerWebContentsDelegate(window)); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 void UserManagerMac::OnGuestProfileCreated(Profile* guest_profile, | 207 void UserManagerMac::OnGuestProfileCreated(Profile* guest_profile, |
207 const std::string& url) { | 208 const std::string& url) { |
208 instance_ = new UserManagerMac(guest_profile); | 209 instance_ = new UserManagerMac(guest_profile); |
209 [instance_->window_controller_ showURL:GURL(url)]; | 210 [instance_->window_controller_ showURL:GURL(url)]; |
210 } | 211 } |
211 | 212 |
212 void UserManagerMac::WindowWasClosed() { | 213 void UserManagerMac::WindowWasClosed() { |
213 instance_ = NULL; | 214 instance_ = NULL; |
214 delete this; | 215 delete this; |
215 } | 216 } |
OLD | NEW |