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

Side by Side Diff: chrome/browser/ui/cocoa/profiles/user_manager_mac.mm

Issue 1432143002: Track where WebContents are created in order to better understand issue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
OLDNEW
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 "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #import "chrome/browser/app_controller_mac.h" 9 #import "chrome/browser/app_controller_mac.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" 21 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
22 #include "chrome/browser/ui/user_manager.h" 22 #include "chrome/browser/ui/user_manager.h"
23 #include "chrome/grit/chromium_strings.h" 23 #include "chrome/grit/chromium_strings.h"
24 #include "components/web_modal/web_contents_modal_dialog_host.h" 24 #include "components/web_modal/web_contents_modal_dialog_host.h"
25 #include "components/web_modal/web_contents_modal_dialog_manager.h" 25 #include "components/web_modal/web_contents_modal_dialog_manager.h"
26 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" 26 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
27 #include "content/public/browser/native_web_keyboard_event.h" 27 #include "content/public/browser/native_web_keyboard_event.h"
28 #include "content/public/browser/render_widget_host_view.h" 28 #include "content/public/browser/render_widget_host_view.h"
29 #include "content/public/browser/web_contents.h" 29 #include "content/public/browser/web_contents.h"
30 #include "content/public/browser/web_contents_delegate.h" 30 #include "content/public/browser/web_contents_delegate.h"
31 #include "content/public/browser/web_contents_source.h"
31 #include "ui/base/l10n/l10n_util_mac.h" 32 #include "ui/base/l10n/l10n_util_mac.h"
32 #include "ui/events/keycodes/keyboard_codes.h" 33 #include "ui/events/keycodes/keyboard_codes.h"
33 34
34 namespace { 35 namespace {
35 36
36 // Update the App Controller with a new Profile. Used when a Profile is locked 37 // Update the App Controller with a new Profile. Used when a Profile is locked
37 // to set the Controller to the Guest profile so the old Profile's bookmarks, 38 // to set the Controller to the Guest profile so the old Profile's bookmarks,
38 // etc... cannot be accessed. 39 // etc... cannot be accessed.
39 void ChangeAppControllerForProfile(Profile* profile, 40 void ChangeAppControllerForProfile(Profile* profile,
40 Profile::CreateStatus status) { 41 Profile::CreateStatus status) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 0, 0, UserManager::kReauthDialogWidth, UserManager::kReauthDialogHeight); 188 0, 0, UserManager::kReauthDialogWidth, UserManager::kReauthDialogHeight);
188 base::scoped_nsobject<ConstrainedWindowCustomWindow> window( 189 base::scoped_nsobject<ConstrainedWindowCustomWindow> window(
189 [[ConstrainedWindowCustomWindow alloc] 190 [[ConstrainedWindowCustomWindow alloc]
190 initWithContentRect:frame 191 initWithContentRect:frame
191 styleMask:NSTitledWindowMask | NSClosableWindowMask]); 192 styleMask:NSTitledWindowMask | NSClosableWindowMask]);
192 if ((self = [super initWithWindow:window])) { 193 if ((self = [super initWithWindow:window])) {
193 webContents_ = webContents; 194 webContents_ = webContents;
194 195
195 reauthWebContents_.reset(content::WebContents::Create( 196 reauthWebContents_.reset(content::WebContents::Create(
196 content::WebContents::CreateParams(profile))); 197 content::WebContents::CreateParams(profile)));
198 WebContentsSource::CreateForWebContentsAndLocation(reauthWebContents_.get(),
199 FROM_HERE);
197 window.get().contentView = reauthWebContents_->GetNativeView(); 200 window.get().contentView = reauthWebContents_->GetNativeView();
198 webContentsDelegate_.reset( 201 webContentsDelegate_.reset(
199 new ReauthDialogDelegate(reauthWebContents_.get(), emailAddress_)); 202 new ReauthDialogDelegate(reauthWebContents_.get(), emailAddress_));
200 reauthWebContents_->SetDelegate(webContentsDelegate_.get()); 203 reauthWebContents_->SetDelegate(webContentsDelegate_.get());
201 204
202 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( 205 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet(
203 [[CustomConstrainedWindowSheet alloc] 206 [[CustomConstrainedWindowSheet alloc]
204 initWithCustomWindow:[self window]]); 207 initWithCustomWindow:[self window]]);
205 constrained_window_.reset( 208 constrained_window_.reset(
206 new ConstrainedWindowMac( 209 new ConstrainedWindowMac(
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 [window setTitle:l10n_util::GetNSString(IDS_PRODUCT_NAME)]; 289 [window setTitle:l10n_util::GetNSString(IDS_PRODUCT_NAME)];
287 [window setMinSize:NSMakeSize(UserManager::kWindowWidth, 290 [window setMinSize:NSMakeSize(UserManager::kWindowWidth,
288 UserManager::kWindowHeight)]; 291 UserManager::kWindowHeight)];
289 292
290 if ((self = [super initWithWindow:window])) { 293 if ((self = [super initWithWindow:window])) {
291 userManagerObserver_ = userManagerObserver; 294 userManagerObserver_ = userManagerObserver;
292 295
293 // Initialize the web view. 296 // Initialize the web view.
294 webContents_.reset(content::WebContents::Create( 297 webContents_.reset(content::WebContents::Create(
295 content::WebContents::CreateParams(profile))); 298 content::WebContents::CreateParams(profile)));
299 WebContentsSource::CreateForWebContentsAndLocation(webContents_.get(),
300 FROM_HERE);
296 window.contentView = webContents_->GetNativeView(); 301 window.contentView = webContents_->GetNativeView();
297 webContentsDelegate_.reset(new UserManagerWebContentsDelegate()); 302 webContentsDelegate_.reset(new UserManagerWebContentsDelegate());
298 webContents_->SetDelegate(webContentsDelegate_.get()); 303 webContents_->SetDelegate(webContentsDelegate_.get());
299 304
300 web_modal::WebContentsModalDialogManager::CreateForWebContents( 305 web_modal::WebContentsModalDialogManager::CreateForWebContents(
301 webContents_.get()); 306 webContents_.get());
302 modal_manager_delegate_.reset( 307 modal_manager_delegate_.reset(
303 new UserManagerModalManagerDelegate([[self window] contentView])); 308 new UserManagerModalManagerDelegate([[self window] contentView]));
304 web_modal::WebContentsModalDialogManager::FromWebContents( 309 web_modal::WebContentsModalDialogManager::FromWebContents(
305 webContents_.get())->SetDelegate(modal_manager_delegate_.get()); 310 webContents_.get())->SetDelegate(modal_manager_delegate_.get());
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 ProfileMetrics::LogTimeToOpenUserManager( 477 ProfileMetrics::LogTimeToOpenUserManager(
473 base::Time::Now() - user_manager_started_showing_); 478 base::Time::Now() - user_manager_started_showing_);
474 user_manager_started_showing_ = base::Time(); 479 user_manager_started_showing_ = base::Time();
475 } 480 }
476 481
477 void UserManagerMac::WindowWasClosed() { 482 void UserManagerMac::WindowWasClosed() {
478 CloseReauthDialog(); 483 CloseReauthDialog();
479 instance_ = NULL; 484 instance_ = NULL;
480 delete this; 485 delete this;
481 } 486 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698