Rename string16 to base::string16.

This commit is contained in:
Cheng Zhao 2014-06-28 19:36:57 +08:00
parent c713deb1e8
commit e0e1d45859
10 changed files with 40 additions and 38 deletions

View file

@ -111,7 +111,7 @@ bool Menu::IsItemForCommandIdDynamic(int command_id) const {
command_id)->BooleanValue(); 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::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate); v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
@ -121,12 +121,12 @@ string16 Menu::GetLabelForCommandId(int command_id) const {
const_cast<Menu*>(this)->GetWrapper(isolate), const_cast<Menu*>(this)->GetWrapper(isolate),
"getLabelForCommandId", "getLabelForCommandId",
command_id); command_id);
string16 label; base::string16 label;
mate::ConvertFromV8(node_isolate, result, &label); mate::ConvertFromV8(node_isolate, result, &label);
return 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::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate); v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
@ -136,7 +136,7 @@ string16 Menu::GetSublabelForCommandId(int command_id) const {
const_cast<Menu*>(this)->GetWrapper(isolate), const_cast<Menu*>(this)->GetWrapper(isolate),
"getSubLabelForCommandId", "getSubLabelForCommandId",
command_id); command_id);
string16 label; base::string16 label;
mate::ConvertFromV8(isolate, result, &label); mate::ConvertFromV8(isolate, result, &label);
return label; return label;
} }

View file

@ -48,8 +48,8 @@ class Menu : public mate::Wrappable,
int command_id, int command_id,
ui::Accelerator* accelerator) OVERRIDE; ui::Accelerator* accelerator) OVERRIDE;
virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE;
virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE; virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE;
virtual string16 GetSublabelForCommandId(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 ExecuteCommand(int command_id, int event_flags) OVERRIDE;
virtual void MenuWillShow(ui::SimpleMenuModel* source) OVERRIDE; virtual void MenuWillShow(ui::SimpleMenuModel* source) OVERRIDE;

View file

@ -87,7 +87,7 @@ GURL WebContents::GetURL() const {
return web_contents()->GetURL(); return web_contents()->GetURL();
} }
string16 WebContents::GetTitle() const { base::string16 WebContents::GetTitle() const {
return web_contents()->GetTitle(); return web_contents()->GetTitle();
} }
@ -154,12 +154,12 @@ bool WebContents::IsCrashed() const {
return web_contents()->IsCrashed(); return web_contents()->IsCrashed();
} }
void WebContents::ExecuteJavaScript(const string16& code) { void WebContents::ExecuteJavaScript(const base::string16& code) {
web_contents()->GetRenderViewHost()->ExecuteJavascriptInWebFrame( 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) { const base::ListValue& args) {
return Send(new AtomViewMsg_Message(routing_id(), channel, args)); return Send(new AtomViewMsg_Message(routing_id(), channel, args));
} }
@ -190,13 +190,13 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
.SetMethod("_send", &WebContents::SendIPCMessage); .SetMethod("_send", &WebContents::SendIPCMessage);
} }
void WebContents::OnRendererMessage(const string16& channel, void WebContents::OnRendererMessage(const base::string16& channel,
const base::ListValue& args) { const base::ListValue& args) {
// webContents.emit(channel, new Event(), args...); // webContents.emit(channel, new Event(), args...);
Emit(UTF16ToUTF8(channel), args, web_contents(), NULL); Emit(UTF16ToUTF8(channel), args, web_contents(), NULL);
} }
void WebContents::OnRendererMessageSync(const string16& channel, void WebContents::OnRendererMessageSync(const base::string16& channel,
const base::ListValue& args, const base::ListValue& args,
IPC::Message* message) { IPC::Message* message) {
// webContents.emit(channel, new Event(sender, message), args...); // webContents.emit(channel, new Event(sender, message), args...);

View file

@ -22,7 +22,7 @@ class WebContents : public mate::EventEmitter,
bool IsAlive() const; bool IsAlive() const;
void LoadURL(const GURL& url); void LoadURL(const GURL& url);
GURL GetURL() const; GURL GetURL() const;
string16 GetTitle() const; base::string16 GetTitle() const;
bool IsLoading() const; bool IsLoading() const;
bool IsWaitingForResponse() const; bool IsWaitingForResponse() const;
void Stop(); void Stop();
@ -38,8 +38,9 @@ class WebContents : public mate::EventEmitter,
int GetRoutingID() const; int GetRoutingID() const;
int GetProcessID() const; int GetProcessID() const;
bool IsCrashed() const; bool IsCrashed() const;
void ExecuteJavaScript(const string16& code); void ExecuteJavaScript(const base::string16& code);
bool SendIPCMessage(const string16& channel, const base::ListValue& args); bool SendIPCMessage(const base::string16& channel,
const base::ListValue& args);
protected: protected:
explicit WebContents(content::WebContents* web_contents); explicit WebContents(content::WebContents* web_contents);
@ -65,10 +66,11 @@ class WebContents : public mate::EventEmitter,
private: private:
// Called when received a message from renderer. // 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. // Called when received a synchronous message from renderer.
void OnRendererMessageSync(const string16& channel, void OnRendererMessageSync(const base::string16& channel,
const base::ListValue& args, const base::ListValue& args,
IPC::Message* message); IPC::Message* message);

View file

@ -45,7 +45,7 @@ void Event::PreventDefault() {
prevent_default_ = true; prevent_default_ = true;
} }
bool Event::SendReply(const string16& json) { bool Event::SendReply(const base::string16& json) {
if (message_ == NULL || sender_ == NULL) if (message_ == NULL || sender_ == NULL)
return false; return false;

View file

@ -27,7 +27,7 @@ class Event : public Wrappable,
void PreventDefault(); void PreventDefault();
// event.sendReply(json), used for replying synchronous message. // event.sendReply(json), used for replying synchronous message.
bool SendReply(const string16& json); bool SendReply(const base::string16& json);
// Whether event.preventDefault() is called. // Whether event.preventDefault() is called.
bool prevent_default() const { return prevent_default_; } bool prevent_default() const { return prevent_default_; }

View file

@ -15,21 +15,21 @@ void AtomJavaScriptDialogManager::RunJavaScriptDialog(
const GURL& origin_url, const GURL& origin_url,
const std::string& accept_lang, const std::string& accept_lang,
content::JavaScriptMessageType javascript_message_type, content::JavaScriptMessageType javascript_message_type,
const string16& message_text, const base::string16& message_text,
const string16& default_prompt_text, const base::string16& default_prompt_text,
const DialogClosedCallback& callback, const DialogClosedCallback& callback,
bool* did_suppress_message) { bool* did_suppress_message) {
callback.Run(false, string16()); callback.Run(false, base::string16());
} }
void AtomJavaScriptDialogManager::RunBeforeUnloadDialog( void AtomJavaScriptDialogManager::RunBeforeUnloadDialog(
content::WebContents* web_contents, content::WebContents* web_contents,
const string16& message_text, const base::string16& message_text,
bool is_reload, bool is_reload,
const DialogClosedCallback& callback) { const DialogClosedCallback& callback) {
bool prevent_reload = message_text.empty() || bool prevent_reload = message_text.empty() ||
message_text == ASCIIToUTF16("false"); message_text == base::ASCIIToUTF16("false");
callback.Run(!prevent_reload, message_text); callback.Run(!prevent_reload, message_text);
} }

View file

@ -19,13 +19,13 @@ class AtomJavaScriptDialogManager : public content::JavaScriptDialogManager {
const GURL& origin_url, const GURL& origin_url,
const std::string& accept_lang, const std::string& accept_lang,
content::JavaScriptMessageType javascript_message_type, content::JavaScriptMessageType javascript_message_type,
const string16& message_text, const base::string16& message_text,
const string16& default_prompt_text, const base::string16& default_prompt_text,
const DialogClosedCallback& callback, const DialogClosedCallback& callback,
bool* did_suppress_message) OVERRIDE; bool* did_suppress_message) OVERRIDE;
virtual void RunBeforeUnloadDialog( virtual void RunBeforeUnloadDialog(
content::WebContents* web_contents, content::WebContents* web_contents,
const string16& message_text, const base::string16& message_text,
bool is_reload, bool is_reload,
const DialogClosedCallback& callback) OVERRIDE; const DialogClosedCallback& callback) OVERRIDE;
virtual void CancelActiveAndPendingDialogs( virtual void CancelActiveAndPendingDialogs(

View file

@ -21,17 +21,17 @@ IPC_STRUCT_TRAITS_BEGIN(atom::DraggableRegion)
IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_END()
IPC_MESSAGE_ROUTED2(AtomViewHostMsg_Message, IPC_MESSAGE_ROUTED2(AtomViewHostMsg_Message,
string16 /* channel */, base::string16 /* channel */,
ListValue /* arguments */) base::ListValue /* arguments */)
IPC_SYNC_MESSAGE_ROUTED2_1(AtomViewHostMsg_Message_Sync, IPC_SYNC_MESSAGE_ROUTED2_1(AtomViewHostMsg_Message_Sync,
string16 /* channel */, base::string16 /* channel */,
ListValue /* arguments */, base::ListValue /* arguments */,
string16 /* result (in JSON) */) base::string16 /* result (in JSON) */)
IPC_MESSAGE_ROUTED2(AtomViewMsg_Message, IPC_MESSAGE_ROUTED2(AtomViewMsg_Message,
string16 /* channel */, base::string16 /* channel */,
ListValue /* arguments */) base::ListValue /* arguments */)
// Sent by the renderer when the draggable regions are updated. // Sent by the renderer when the draggable regions are updated.
IPC_MESSAGE_ROUTED1(AtomViewHostMsg_UpdateDraggableRegions, IPC_MESSAGE_ROUTED1(AtomViewHostMsg_UpdateDraggableRegions,

View file

@ -11,17 +11,17 @@
namespace mate { namespace mate {
template<> template<>
struct Converter<string16> { struct Converter<base::string16> {
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
const string16& val) { const base::string16& val) {
return MATE_STRING_NEW_FROM_UTF16( return MATE_STRING_NEW_FROM_UTF16(
isolate, reinterpret_cast<const uint16_t*>(val.data()), val.size()); isolate, reinterpret_cast<const uint16_t*>(val.data()), val.size());
} }
static bool FromV8(v8::Isolate* isolate, static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val, v8::Handle<v8::Value> val,
string16* out) { base::string16* out) {
v8::String::Value s(val); v8::String::Value s(val);
out->assign(reinterpret_cast<const char16*>(*s), s.length()); out->assign(reinterpret_cast<const base::char16*>(*s), s.length());
return true; return true;
} }
}; };