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

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

Issue 7757006: Allow no arguments in ConstrainedHtmlUI::OnDialogClose() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Handle no arguments in ConstrainedHtmlUI::OnDialogCloseMessage(). Created 9 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_html_ui.h" 5 #include "chrome/browser/ui/webui/constrained_html_ui.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/ui/webui/html_dialog_ui.h" 9 #include "chrome/browser/ui/webui/html_dialog_ui.h"
10 #include "content/browser/renderer_host/render_view_host.h" 10 #include "content/browser/renderer_host/render_view_host.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 RegisterMessageCallback("DialogClose", 42 RegisterMessageCallback("DialogClose",
43 NewCallback(this, &ConstrainedHtmlUI::OnDialogCloseMessage)); 43 NewCallback(this, &ConstrainedHtmlUI::OnDialogCloseMessage));
44 } 44 }
45 45
46 void ConstrainedHtmlUI::OnDialogCloseMessage(const ListValue* args) { 46 void ConstrainedHtmlUI::OnDialogCloseMessage(const ListValue* args) {
47 ConstrainedHtmlUIDelegate* delegate = GetConstrainedDelegate(); 47 ConstrainedHtmlUIDelegate* delegate = GetConstrainedDelegate();
48 if (!delegate) 48 if (!delegate)
49 return; 49 return;
50 50
51 std::string json_retval; 51 std::string json_retval;
52 if (!args->GetString(0, &json_retval)) 52 if (!args->empty() && !args->GetString(0, &json_retval))
53 NOTREACHED() << "Could not read JSON argument"; 53 NOTREACHED() << "Could not read JSON argument";
54 delegate->GetHtmlDialogUIDelegate()->OnDialogClosed(json_retval); 54 delegate->GetHtmlDialogUIDelegate()->OnDialogClosed(json_retval);
55 delegate->OnDialogCloseFromWebUI(); 55 delegate->OnDialogCloseFromWebUI();
56 } 56 }
57 57
58 ConstrainedHtmlUIDelegate* 58 ConstrainedHtmlUIDelegate*
59 ConstrainedHtmlUI::GetConstrainedDelegate() { 59 ConstrainedHtmlUI::GetConstrainedDelegate() {
60 ConstrainedHtmlUIDelegate** property = 60 ConstrainedHtmlUIDelegate** property =
61 GetPropertyAccessor().GetProperty(tab_contents()->property_bag()); 61 GetPropertyAccessor().GetProperty(tab_contents()->property_bag());
62 return property ? *property : NULL; 62 return property ? *property : NULL;
63 } 63 }
64 64
65 // static 65 // static
66 PropertyAccessor<ConstrainedHtmlUIDelegate*>& 66 PropertyAccessor<ConstrainedHtmlUIDelegate*>&
67 ConstrainedHtmlUI::GetPropertyAccessor() { 67 ConstrainedHtmlUI::GetPropertyAccessor() {
68 return g_constrained_html_ui_property_accessor.Get(); 68 return g_constrained_html_ui_property_accessor.Get();
69 } 69 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698