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

Unified Diff: chrome/browser/dom_ui/dom_ui.cc

Issue 20110: Initial checkin of the HTML downloads UI. It's not yet complete (lacking... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/dom_ui/dom_ui.h ('k') | chrome/browser/dom_ui/dom_ui_contents.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/dom_ui.cc
===================================================================
--- chrome/browser/dom_ui/dom_ui.cc (revision 9684)
+++ chrome/browser/dom_ui/dom_ui.cc (working copy)
@@ -47,6 +47,11 @@
callback->second->Run(value.get());
}
+void DOMUI::CallJavascriptFunction(const std::wstring& function_name) {
+ std::wstring javascript = function_name + L"();";
+ ExecuteJavascript(javascript);
+}
+
void DOMUI::CallJavascriptFunction(const std::wstring& function_name,
const Value& arg) {
std::string json;
@@ -122,4 +127,41 @@
}
}
dictionary->SetString(L"title", title_to_set);
-}
+}
+
+int DOMMessageHandler::ExtractIntegerValue(const Value* value) {
+ if (value && value->GetType() == Value::TYPE_LIST) {
+ const ListValue* list_value = static_cast<const ListValue*>(value);
+ Value* list_member;
+
+ // Get id.
+ if (list_value->Get(0, &list_member) &&
+ list_member->GetType() == Value::TYPE_STRING) {
+ const StringValue* string_value =
+ static_cast<const StringValue*>(list_member);
+ std::wstring wstring_value;
+ string_value->GetAsString(&wstring_value);
+ return StringToInt(wstring_value);
+ }
+ }
+ return NULL;
Paul Godavari 2009/02/17 22:23:19 Nit: I think this should return some default value
+}
+
+std::wstring DOMMessageHandler::ExtractStringValue(const Value* value) {
+ if (value && value->GetType() == Value::TYPE_LIST) {
+ const ListValue* list_value = static_cast<const ListValue*>(value);
+ Value* list_member;
+
+ // Get id.
+ if (list_value->Get(0, &list_member) &&
+ list_member->GetType() == Value::TYPE_STRING) {
+ const StringValue* string_value =
+ static_cast<const StringValue*>(list_member);
+ std::wstring wstring_value;
+ string_value->GetAsString(&wstring_value);
+ return wstring_value;
+ }
+ }
+ return std::wstring();
+}
+
« no previous file with comments | « chrome/browser/dom_ui/dom_ui.h ('k') | chrome/browser/dom_ui/dom_ui_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698