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/generated_resources.h" | 16 #include "grit/chromium_strings.h" |
17 #include "ui/base/l10n/l10n_util_mac.h" | 17 #include "ui/base/l10n/l10n_util_mac.h" |
18 | 18 |
19 // Default window size. Taken from the views implementation in | 19 // Default window size. Taken from the views implementation in |
20 // chrome/browser/ui/views/user_manager_view.cc. | 20 // chrome/browser/ui/views/user_manager_view.cc. |
21 // TODO(noms): Figure out if this size can be computed dynamically or adjusted | 21 // TODO(noms): Figure out if this size can be computed dynamically or adjusted |
22 // for smaller screens. | 22 // for smaller screens. |
23 const int kWindowWidth = 900; | 23 const int kWindowWidth = 900; |
24 const int kWindowHeight = 700; | 24 const int kWindowHeight = 700; |
25 | 25 |
26 namespace chrome { | 26 namespace chrome { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 NSRect contentRect = NSMakeRect((screenWidth - kWindowWidth) / 2, | 101 NSRect contentRect = NSMakeRect((screenWidth - kWindowWidth) / 2, |
102 (screenHeight - kWindowHeight) / 2, | 102 (screenHeight - kWindowHeight) / 2, |
103 kWindowWidth, kWindowHeight); | 103 kWindowWidth, kWindowHeight); |
104 ChromeEventProcessingWindow* window = [[ChromeEventProcessingWindow alloc] | 104 ChromeEventProcessingWindow* window = [[ChromeEventProcessingWindow alloc] |
105 initWithContentRect:contentRect | 105 initWithContentRect:contentRect |
106 styleMask:NSTitledWindowMask | | 106 styleMask:NSTitledWindowMask | |
107 NSClosableWindowMask | | 107 NSClosableWindowMask | |
108 NSResizableWindowMask | 108 NSResizableWindowMask |
109 backing:NSBackingStoreBuffered | 109 backing:NSBackingStoreBuffered |
110 defer:NO]; | 110 defer:NO]; |
111 [window setTitle:l10n_util::GetNSString(IDS_USER_MANAGER_SCREEN_TITLE)]; | 111 [window setTitle:l10n_util::GetNSString(IDS_PRODUCT_NAME)]; |
112 [window setMinSize:NSMakeSize(kWindowWidth, kWindowHeight)]; | 112 [window setMinSize:NSMakeSize(kWindowWidth, kWindowHeight)]; |
113 | 113 |
114 if ((self = [super initWithWindow:window])) { | 114 if ((self = [super initWithWindow:window])) { |
115 userManagerObserver_ = userManagerObserver; | 115 userManagerObserver_ = userManagerObserver; |
116 | 116 |
117 // Initialize the web view. | 117 // Initialize the web view. |
118 webContents_.reset(content::WebContents::Create( | 118 webContents_.reset(content::WebContents::Create( |
119 content::WebContents::CreateParams(profile))); | 119 content::WebContents::CreateParams(profile))); |
120 window.contentView = webContents_->GetNativeView(); | 120 window.contentView = webContents_->GetNativeView(); |
121 webContentsDelegate_.reset(new UserManagerWebContentsDelegate(window)); | 121 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, | 206 void UserManagerMac::OnGuestProfileCreated(Profile* guest_profile, |
207 const std::string& url) { | 207 const std::string& url) { |
208 instance_ = new UserManagerMac(guest_profile); | 208 instance_ = new UserManagerMac(guest_profile); |
209 [instance_->window_controller_ showURL:GURL(url)]; | 209 [instance_->window_controller_ showURL:GURL(url)]; |
210 } | 210 } |
211 | 211 |
212 void UserManagerMac::WindowWasClosed() { | 212 void UserManagerMac::WindowWasClosed() { |
213 instance_ = NULL; | 213 instance_ = NULL; |
214 delete this; | 214 delete this; |
215 } | 215 } |
OLD | NEW |