| 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/webui/constrained_web_dialog_delegate_base.h" | 5 #include "chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/property_bag.h" | |
| 10 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/constrained_window.h" | 10 #include "chrome/browser/ui/constrained_window.h" |
| 12 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 11 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 13 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" | 12 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" |
| 14 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 15 #include "ipc/ipc_message.h" | 14 #include "ipc/ipc_message.h" |
| 16 #include "ui/web_dialogs/web_dialog_delegate.h" | 15 #include "ui/web_dialogs/web_dialog_delegate.h" |
| 17 #include "ui/web_dialogs/web_dialog_ui.h" | 16 #include "ui/web_dialogs/web_dialog_ui.h" |
| 18 | 17 |
| 19 using content::NativeWebKeyboardEvent; | 18 using content::NativeWebKeyboardEvent; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 34 CHECK(delegate); | 33 CHECK(delegate); |
| 35 WebContents* web_contents = | 34 WebContents* web_contents = |
| 36 WebContents::Create(profile, NULL, MSG_ROUTING_NONE, NULL); | 35 WebContents::Create(profile, NULL, MSG_ROUTING_NONE, NULL); |
| 37 tab_.reset(new TabContents(web_contents)); | 36 tab_.reset(new TabContents(web_contents)); |
| 38 if (tab_delegate) { | 37 if (tab_delegate) { |
| 39 override_tab_delegate_.reset(tab_delegate); | 38 override_tab_delegate_.reset(tab_delegate); |
| 40 web_contents->SetDelegate(tab_delegate); | 39 web_contents->SetDelegate(tab_delegate); |
| 41 } else { | 40 } else { |
| 42 web_contents->SetDelegate(this); | 41 web_contents->SetDelegate(this); |
| 43 } | 42 } |
| 44 // Set |this| as a property so the ConstrainedWebDialogUI can retrieve it. | 43 // Set |this| as a delegate so the ConstrainedWebDialogUI can retrieve it. |
| 45 ConstrainedWebDialogUI::GetPropertyAccessor().SetProperty( | 44 ConstrainedWebDialogUI::SetConstrainedDelegate(web_contents, this); |
| 46 web_contents->GetPropertyBag(), this); | |
| 47 | 45 |
| 48 web_contents->GetController().LoadURL(delegate->GetDialogContentURL(), | 46 web_contents->GetController().LoadURL(delegate->GetDialogContentURL(), |
| 49 content::Referrer(), | 47 content::Referrer(), |
| 50 content::PAGE_TRANSITION_START_PAGE, | 48 content::PAGE_TRANSITION_START_PAGE, |
| 51 std::string()); | 49 std::string()); |
| 52 } | 50 } |
| 53 | 51 |
| 54 ConstrainedWebDialogDelegateBase::~ConstrainedWebDialogDelegateBase() { | 52 ConstrainedWebDialogDelegateBase::~ConstrainedWebDialogDelegateBase() { |
| 55 if (release_tab_on_close_) | 53 if (release_tab_on_close_) |
| 56 ignore_result(tab_.release()); | 54 ignore_result(tab_.release()); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 91 } |
| 94 | 92 |
| 95 TabContents* ConstrainedWebDialogDelegateBase::tab() { | 93 TabContents* ConstrainedWebDialogDelegateBase::tab() { |
| 96 return tab_.get(); | 94 return tab_.get(); |
| 97 } | 95 } |
| 98 | 96 |
| 99 void ConstrainedWebDialogDelegateBase::HandleKeyboardEvent( | 97 void ConstrainedWebDialogDelegateBase::HandleKeyboardEvent( |
| 100 content::WebContents* source, | 98 content::WebContents* source, |
| 101 const NativeWebKeyboardEvent& event) { | 99 const NativeWebKeyboardEvent& event) { |
| 102 } | 100 } |
| OLD | NEW |