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

Side by Side Diff: chrome/browser/ui/cocoa/web_dialog_window_controller.mm

Issue 10534093: TabContentsWrapper -> TabContents, part 37. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months 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 | Annotate | Revision Log
OLDNEW
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 #import "chrome/browser/ui/cocoa/web_dialog_window_controller.h" 5 #import "chrome/browser/ui/cocoa/web_dialog_window_controller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_nsobject.h" 8 #include "base/memory/scoped_nsobject.h"
9 #include "base/property_bag.h" 9 #include "base/property_bag.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #import "chrome/browser/ui/browser_dialogs.h" 13 #import "chrome/browser/ui/browser_dialogs.h"
14 #import "chrome/browser/ui/cocoa/browser_command_executor.h" 14 #import "chrome/browser/ui/cocoa/browser_command_executor.h"
15 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" 15 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h"
16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 16 #include "chrome/browser/ui/tab_contents/tab_contents.h"
17 #include "chrome/browser/ui/webui/web_dialog_controller.h" 17 #include "chrome/browser/ui/webui/web_dialog_controller.h"
18 #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h" 18 #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h"
19 #include "content/public/browser/native_web_keyboard_event.h" 19 #include "content/public/browser/native_web_keyboard_event.h"
20 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
21 #include "content/public/browser/web_ui_message_handler.h" 21 #include "content/public/browser/web_ui_message_handler.h"
22 #include "ui/base/keycodes/keyboard_codes.h" 22 #include "ui/base/keycodes/keyboard_codes.h"
23 #include "ui/gfx/size.h" 23 #include "ui/gfx/size.h"
24 #include "ui/web_dialogs/web_dialog_delegate.h" 24 #include "ui/web_dialogs/web_dialog_delegate.h"
25 25
26 using content::NativeWebKeyboardEvent; 26 using content::NativeWebKeyboardEvent;
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 [window setDelegate:self]; 344 [window setDelegate:self];
345 [window setTitle:base::SysUTF16ToNSString(delegate->GetDialogTitle())]; 345 [window setTitle:base::SysUTF16ToNSString(delegate->GetDialogTitle())];
346 [window setMinSize:dialogRect.size]; 346 [window setMinSize:dialogRect.size];
347 [window center]; 347 [window center];
348 delegate_.reset( 348 delegate_.reset(
349 new WebDialogWindowDelegateBridge(self, profile, browser, delegate)); 349 new WebDialogWindowDelegateBridge(self, profile, browser, delegate));
350 return self; 350 return self;
351 } 351 }
352 352
353 - (void)loadDialogContents { 353 - (void)loadDialogContents {
354 contentsWrapper_.reset(new TabContentsWrapper(WebContents::Create( 354 tabContents_.reset(new TabContents(WebContents::Create(
355 delegate_->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL))); 355 delegate_->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL)));
356 [[self window] 356 [[self window]
357 setContentView:contentsWrapper_->web_contents()->GetNativeView()]; 357 setContentView:tabContents_->web_contents()->GetNativeView()];
358 contentsWrapper_->web_contents()->SetDelegate(delegate_.get()); 358 tabContents_->web_contents()->SetDelegate(delegate_.get());
359 359
360 // This must be done before loading the page; see the comments in 360 // This must be done before loading the page; see the comments in
361 // WebDialogUI. 361 // WebDialogUI.
362 WebDialogUI::GetPropertyAccessor().SetProperty( 362 WebDialogUI::GetPropertyAccessor().SetProperty(
363 contentsWrapper_->web_contents()->GetPropertyBag(), delegate_.get()); 363 tabContents_->web_contents()->GetPropertyBag(), delegate_.get());
364 364
365 contentsWrapper_->web_contents()->GetController().LoadURL( 365 tabContents_->web_contents()->GetController().LoadURL(
366 delegate_->GetDialogContentURL(), 366 delegate_->GetDialogContentURL(),
367 content::Referrer(), 367 content::Referrer(),
368 content::PAGE_TRANSITION_START_PAGE, 368 content::PAGE_TRANSITION_START_PAGE,
369 std::string()); 369 std::string());
370 370
371 // TODO(akalin): add accelerator for ESC to close the dialog box. 371 // TODO(akalin): add accelerator for ESC to close the dialog box.
372 // 372 //
373 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender 373 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender
374 // to do the above doesn't work. 374 // to do the above doesn't work.
375 } 375 }
376 376
377 - (void)windowWillClose:(NSNotification*)notification { 377 - (void)windowWillClose:(NSNotification*)notification {
378 delegate_->WindowControllerClosed(); 378 delegate_->WindowControllerClosed();
379 [self autorelease]; 379 [self autorelease];
380 } 380 }
381 381
382 @end 382 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/web_dialog_window_controller.h ('k') | chrome/browser/ui/cocoa/web_intent_picker_cocoa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698