From e0e1d45859da953657149c3242983a865d6d554f Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sat, 28 Jun 2014 19:36:57 +0800 Subject: [PATCH] Rename string16 to base::string16. --- atom/browser/api/atom_api_menu.cc | 8 ++++---- atom/browser/api/atom_api_menu.h | 4 ++-- atom/browser/api/atom_api_web_contents.cc | 12 ++++++------ atom/browser/api/atom_api_web_contents.h | 12 +++++++----- atom/browser/api/event.cc | 2 +- atom/browser/api/event.h | 2 +- atom/browser/atom_javascript_dialog_manager.cc | 10 +++++----- atom/browser/atom_javascript_dialog_manager.h | 6 +++--- atom/common/api/api_messages.h | 14 +++++++------- .../native_mate_converters/string16_converter.h | 8 ++++---- 10 files changed, 40 insertions(+), 38 deletions(-) diff --git a/atom/browser/api/atom_api_menu.cc b/atom/browser/api/atom_api_menu.cc index d93d84fdd112..2be0c0ac30df 100644 --- a/atom/browser/api/atom_api_menu.cc +++ b/atom/browser/api/atom_api_menu.cc @@ -111,7 +111,7 @@ bool Menu::IsItemForCommandIdDynamic(int command_id) const { command_id)->BooleanValue(); } -string16 Menu::GetLabelForCommandId(int command_id) const { +base::string16 Menu::GetLabelForCommandId(int command_id) const { v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Locker locker(isolate); v8::HandleScope handle_scope(isolate); @@ -121,12 +121,12 @@ string16 Menu::GetLabelForCommandId(int command_id) const { const_cast(this)->GetWrapper(isolate), "getLabelForCommandId", command_id); - string16 label; + base::string16 label; mate::ConvertFromV8(node_isolate, result, &label); return label; } -string16 Menu::GetSublabelForCommandId(int command_id) const { +base::string16 Menu::GetSublabelForCommandId(int command_id) const { v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Locker locker(isolate); v8::HandleScope handle_scope(isolate); @@ -136,7 +136,7 @@ string16 Menu::GetSublabelForCommandId(int command_id) const { const_cast(this)->GetWrapper(isolate), "getSubLabelForCommandId", command_id); - string16 label; + base::string16 label; mate::ConvertFromV8(isolate, result, &label); return label; } diff --git a/atom/browser/api/atom_api_menu.h b/atom/browser/api/atom_api_menu.h index 2a212d0145a1..2bd63dfab2d0 100644 --- a/atom/browser/api/atom_api_menu.h +++ b/atom/browser/api/atom_api_menu.h @@ -48,8 +48,8 @@ class Menu : public mate::Wrappable, int command_id, ui::Accelerator* accelerator) OVERRIDE; virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; - virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE; - virtual string16 GetSublabelForCommandId(int command_id) const OVERRIDE; + virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE; + virtual base::string16 GetSublabelForCommandId(int command_id) const OVERRIDE; virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; virtual void MenuWillShow(ui::SimpleMenuModel* source) OVERRIDE; diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 84e695ffddec..6eb7690fd8ed 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -87,7 +87,7 @@ GURL WebContents::GetURL() const { return web_contents()->GetURL(); } -string16 WebContents::GetTitle() const { +base::string16 WebContents::GetTitle() const { return web_contents()->GetTitle(); } @@ -154,12 +154,12 @@ bool WebContents::IsCrashed() const { return web_contents()->IsCrashed(); } -void WebContents::ExecuteJavaScript(const string16& code) { +void WebContents::ExecuteJavaScript(const base::string16& code) { web_contents()->GetRenderViewHost()->ExecuteJavascriptInWebFrame( - string16(), code); + base::string16(), code); } -bool WebContents::SendIPCMessage(const string16& channel, +bool WebContents::SendIPCMessage(const base::string16& channel, const base::ListValue& args) { return Send(new AtomViewMsg_Message(routing_id(), channel, args)); } @@ -190,13 +190,13 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder( .SetMethod("_send", &WebContents::SendIPCMessage); } -void WebContents::OnRendererMessage(const string16& channel, +void WebContents::OnRendererMessage(const base::string16& channel, const base::ListValue& args) { // webContents.emit(channel, new Event(), args...); Emit(UTF16ToUTF8(channel), args, web_contents(), NULL); } -void WebContents::OnRendererMessageSync(const string16& channel, +void WebContents::OnRendererMessageSync(const base::string16& channel, const base::ListValue& args, IPC::Message* message) { // webContents.emit(channel, new Event(sender, message), args...); diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 1c42f5256d1e..36c91434d5ee 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -22,7 +22,7 @@ class WebContents : public mate::EventEmitter, bool IsAlive() const; void LoadURL(const GURL& url); GURL GetURL() const; - string16 GetTitle() const; + base::string16 GetTitle() const; bool IsLoading() const; bool IsWaitingForResponse() const; void Stop(); @@ -38,8 +38,9 @@ class WebContents : public mate::EventEmitter, int GetRoutingID() const; int GetProcessID() const; bool IsCrashed() const; - void ExecuteJavaScript(const string16& code); - bool SendIPCMessage(const string16& channel, const base::ListValue& args); + void ExecuteJavaScript(const base::string16& code); + bool SendIPCMessage(const base::string16& channel, + const base::ListValue& args); protected: explicit WebContents(content::WebContents* web_contents); @@ -65,10 +66,11 @@ class WebContents : public mate::EventEmitter, private: // Called when received a message from renderer. - void OnRendererMessage(const string16& channel, const base::ListValue& args); + void OnRendererMessage(const base::string16& channel, + const base::ListValue& args); // Called when received a synchronous message from renderer. - void OnRendererMessageSync(const string16& channel, + void OnRendererMessageSync(const base::string16& channel, const base::ListValue& args, IPC::Message* message); diff --git a/atom/browser/api/event.cc b/atom/browser/api/event.cc index 4bf5b920c5b6..579fa3a41dcf 100644 --- a/atom/browser/api/event.cc +++ b/atom/browser/api/event.cc @@ -45,7 +45,7 @@ void Event::PreventDefault() { prevent_default_ = true; } -bool Event::SendReply(const string16& json) { +bool Event::SendReply(const base::string16& json) { if (message_ == NULL || sender_ == NULL) return false; diff --git a/atom/browser/api/event.h b/atom/browser/api/event.h index 3090586c3615..b1713a4e68c9 100644 --- a/atom/browser/api/event.h +++ b/atom/browser/api/event.h @@ -27,7 +27,7 @@ class Event : public Wrappable, void PreventDefault(); // event.sendReply(json), used for replying synchronous message. - bool SendReply(const string16& json); + bool SendReply(const base::string16& json); // Whether event.preventDefault() is called. bool prevent_default() const { return prevent_default_; } diff --git a/atom/browser/atom_javascript_dialog_manager.cc b/atom/browser/atom_javascript_dialog_manager.cc index 9d83cddb2927..b65e4eabb6dd 100644 --- a/atom/browser/atom_javascript_dialog_manager.cc +++ b/atom/browser/atom_javascript_dialog_manager.cc @@ -15,21 +15,21 @@ void AtomJavaScriptDialogManager::RunJavaScriptDialog( const GURL& origin_url, const std::string& accept_lang, content::JavaScriptMessageType javascript_message_type, - const string16& message_text, - const string16& default_prompt_text, + const base::string16& message_text, + const base::string16& default_prompt_text, const DialogClosedCallback& callback, bool* did_suppress_message) { - callback.Run(false, string16()); + callback.Run(false, base::string16()); } void AtomJavaScriptDialogManager::RunBeforeUnloadDialog( content::WebContents* web_contents, - const string16& message_text, + const base::string16& message_text, bool is_reload, const DialogClosedCallback& callback) { bool prevent_reload = message_text.empty() || - message_text == ASCIIToUTF16("false"); + message_text == base::ASCIIToUTF16("false"); callback.Run(!prevent_reload, message_text); } diff --git a/atom/browser/atom_javascript_dialog_manager.h b/atom/browser/atom_javascript_dialog_manager.h index fe65f2c9d967..b71dccc332f7 100644 --- a/atom/browser/atom_javascript_dialog_manager.h +++ b/atom/browser/atom_javascript_dialog_manager.h @@ -19,13 +19,13 @@ class AtomJavaScriptDialogManager : public content::JavaScriptDialogManager { const GURL& origin_url, const std::string& accept_lang, content::JavaScriptMessageType javascript_message_type, - const string16& message_text, - const string16& default_prompt_text, + const base::string16& message_text, + const base::string16& default_prompt_text, const DialogClosedCallback& callback, bool* did_suppress_message) OVERRIDE; virtual void RunBeforeUnloadDialog( content::WebContents* web_contents, - const string16& message_text, + const base::string16& message_text, bool is_reload, const DialogClosedCallback& callback) OVERRIDE; virtual void CancelActiveAndPendingDialogs( diff --git a/atom/common/api/api_messages.h b/atom/common/api/api_messages.h index 641e99157529..045bceb719af 100644 --- a/atom/common/api/api_messages.h +++ b/atom/common/api/api_messages.h @@ -21,17 +21,17 @@ IPC_STRUCT_TRAITS_BEGIN(atom::DraggableRegion) IPC_STRUCT_TRAITS_END() IPC_MESSAGE_ROUTED2(AtomViewHostMsg_Message, - string16 /* channel */, - ListValue /* arguments */) + base::string16 /* channel */, + base::ListValue /* arguments */) IPC_SYNC_MESSAGE_ROUTED2_1(AtomViewHostMsg_Message_Sync, - string16 /* channel */, - ListValue /* arguments */, - string16 /* result (in JSON) */) + base::string16 /* channel */, + base::ListValue /* arguments */, + base::string16 /* result (in JSON) */) IPC_MESSAGE_ROUTED2(AtomViewMsg_Message, - string16 /* channel */, - ListValue /* arguments */) + base::string16 /* channel */, + base::ListValue /* arguments */) // Sent by the renderer when the draggable regions are updated. IPC_MESSAGE_ROUTED1(AtomViewHostMsg_UpdateDraggableRegions, diff --git a/atom/common/native_mate_converters/string16_converter.h b/atom/common/native_mate_converters/string16_converter.h index a171de5e7446..54f8977a81c8 100644 --- a/atom/common/native_mate_converters/string16_converter.h +++ b/atom/common/native_mate_converters/string16_converter.h @@ -11,17 +11,17 @@ namespace mate { template<> -struct Converter { +struct Converter { static v8::Handle ToV8(v8::Isolate* isolate, - const string16& val) { + const base::string16& val) { return MATE_STRING_NEW_FROM_UTF16( isolate, reinterpret_cast(val.data()), val.size()); } static bool FromV8(v8::Isolate* isolate, v8::Handle val, - string16* out) { + base::string16* out) { v8::String::Value s(val); - out->assign(reinterpret_cast(*s), s.length()); + out->assign(reinterpret_cast(*s), s.length()); return true; } };