| 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_ui.h" | 5 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 101 } |
| 102 | 102 |
| 103 // static | 103 // static |
| 104 void ConstrainedWebDialogUI::SetConstrainedDelegate( | 104 void ConstrainedWebDialogUI::SetConstrainedDelegate( |
| 105 content::WebContents* web_contents, | 105 content::WebContents* web_contents, |
| 106 ConstrainedWebDialogDelegate* delegate) { | 106 ConstrainedWebDialogDelegate* delegate) { |
| 107 web_contents->SetUserData(&kConstrainedWebDialogDelegateUserDataKey, | 107 web_contents->SetUserData(&kConstrainedWebDialogDelegateUserDataKey, |
| 108 new ConstrainedWebDialogDelegateUserData(delegate)); | 108 new ConstrainedWebDialogDelegateUserData(delegate)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 // static |
| 112 void ConstrainedWebDialogUI::ClearConstrainedDelegate( |
| 113 content::WebContents* web_contents) { |
| 114 web_contents->RemoveUserData(&kConstrainedWebDialogDelegateUserDataKey); |
| 115 } |
| 116 |
| 111 ConstrainedWebDialogDelegate* ConstrainedWebDialogUI::GetConstrainedDelegate() { | 117 ConstrainedWebDialogDelegate* ConstrainedWebDialogUI::GetConstrainedDelegate() { |
| 112 ConstrainedWebDialogDelegateUserData* user_data = | 118 ConstrainedWebDialogDelegateUserData* user_data = |
| 113 static_cast<ConstrainedWebDialogDelegateUserData*>( | 119 static_cast<ConstrainedWebDialogDelegateUserData*>( |
| 114 web_ui()->GetWebContents()-> | 120 web_ui()->GetWebContents()-> |
| 115 GetUserData(&kConstrainedWebDialogDelegateUserDataKey)); | 121 GetUserData(&kConstrainedWebDialogDelegateUserDataKey)); |
| 116 | 122 |
| 117 return user_data ? user_data->delegate() : NULL; | 123 return user_data ? user_data->delegate() : NULL; |
| 118 } | 124 } |
| OLD | NEW |