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

Side by Side Diff: chrome/browser/ui/webui/constrained_web_dialog_ui.cc

Issue 2847173004: Switch SupportsUserData uses to use unique_ptr. (Closed)
Patch Set: Created 3 years, 7 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
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 #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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 if (!args->empty() && !args->GetString(0, &json_retval)) 97 if (!args->empty() && !args->GetString(0, &json_retval))
98 NOTREACHED() << "Could not read JSON argument"; 98 NOTREACHED() << "Could not read JSON argument";
99 delegate->GetWebDialogDelegate()->OnDialogClosed(json_retval); 99 delegate->GetWebDialogDelegate()->OnDialogClosed(json_retval);
100 delegate->OnDialogCloseFromWebUI(); 100 delegate->OnDialogCloseFromWebUI();
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(
108 new ConstrainedWebDialogDelegateUserData(delegate)); 108 &kConstrainedWebDialogDelegateUserDataKey,
109 base::MakeUnique<ConstrainedWebDialogDelegateUserData>(delegate));
109 } 110 }
110 111
111 // static 112 // static
112 void ConstrainedWebDialogUI::ClearConstrainedDelegate( 113 void ConstrainedWebDialogUI::ClearConstrainedDelegate(
113 content::WebContents* web_contents) { 114 content::WebContents* web_contents) {
114 web_contents->RemoveUserData(&kConstrainedWebDialogDelegateUserDataKey); 115 web_contents->RemoveUserData(&kConstrainedWebDialogDelegateUserDataKey);
115 } 116 }
116 117
117 ConstrainedWebDialogDelegate* ConstrainedWebDialogUI::GetConstrainedDelegate() { 118 ConstrainedWebDialogDelegate* ConstrainedWebDialogUI::GetConstrainedDelegate() {
118 ConstrainedWebDialogDelegateUserData* user_data = 119 ConstrainedWebDialogDelegateUserData* user_data =
119 static_cast<ConstrainedWebDialogDelegateUserData*>( 120 static_cast<ConstrainedWebDialogDelegateUserData*>(
120 web_ui()->GetWebContents()-> 121 web_ui()->GetWebContents()->
121 GetUserData(&kConstrainedWebDialogDelegateUserDataKey)); 122 GetUserData(&kConstrainedWebDialogDelegateUserDataKey));
122 123
123 return user_data ? user_data->delegate() : NULL; 124 return user_data ? user_data->delegate() : NULL;
124 } 125 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698