Using string from the std

This commit is contained in:
Pierre Laurac 2016-10-12 17:25:31 -07:00 committed by Kevin Sawicki
parent 526debb5ab
commit 9673cee4d7
6 changed files with 9 additions and 12 deletions

View file

@ -729,7 +729,7 @@ void Window::SetAspectRatio(double aspect_ratio, mate::Arguments* args) {
window_->SetAspectRatio(aspect_ratio, extra_size);
}
void Window::PreviewFile(const base::string16& filepath, const base::string16& filename) {
void Window::PreviewFile(const std::string& filepath, const std::string& filename) {
window_->PreviewFile(filepath, filename);
}

View file

@ -170,7 +170,7 @@ class Window : public mate::TrackableObject<Window>,
void SetMenuBarVisibility(bool visible);
bool IsMenuBarVisible();
void SetAspectRatio(double aspect_ratio, mate::Arguments* args);
void PreviewFile(const base::string16& filepath, const base::string16& filename);
void PreviewFile(const std::string& filepath, const std::string& filename);
void SetParentWindow(v8::Local<v8::Value> value, mate::Arguments* args);
v8::Local<v8::Value> GetParentWindow() const;
std::vector<v8::Local<v8::Object>> GetChildWindows() const;

View file

@ -374,7 +374,7 @@ void NativeWindow::SetAspectRatio(double aspect_ratio,
aspect_ratio_extraSize_ = extra_size;
}
void NativeWindow::PreviewFile(const base::string16& filepath, const base::string16& filename) {
void NativeWindow::PreviewFile(const std::string& filepath, const std::string& filename) {
}
void NativeWindow::RequestToClosePage() {

View file

@ -176,7 +176,7 @@ class NativeWindow : public base::SupportsUserData,
double GetAspectRatio();
gfx::Size GetAspectRatioExtraSize();
virtual void SetAspectRatio(double aspect_ratio, const gfx::Size& extra_size);
virtual void PreviewFile(const base::string16& filepath, const base::string16& filename);
virtual void PreviewFile(const std::string& filepath, const std::string& filename);
base::WeakPtr<NativeWindow> GetWeakPtr() {
return weak_factory_.GetWeakPtr();

View file

@ -9,7 +9,6 @@
#include <string>
#include <vector>
#include <Quartz/Quartz.h>
#include "atom/browser/native_window.h"
#include "base/mac/scoped_nsobject.h"
@ -56,7 +55,8 @@ class NativeWindowMac : public NativeWindow,
void SetMovable(bool movable) override;
void SetAspectRatio(double aspect_ratio, const gfx::Size& extra_size)
override;
void PreviewFile(const base::string16& filepath, const base::string16& filename) override;
void PreviewFile(const std::string& filepath, const std::string& filename)
override;
bool IsMovable() override;
void SetMinimizable(bool minimizable) override;
bool IsMinimizable() override;

View file

@ -956,14 +956,11 @@ void NativeWindowMac::SetAspectRatio(double aspect_ratio,
[window_ setResizeIncrements:NSMakeSize(1.0, 1.0)];
}
void NativeWindowMac::PreviewFile(const base::string16& filepath, const base::string16& filename) {
std::string pathStr = base::UTF16ToUTF8(filepath);
std::string nameStr = base::UTF16ToUTF8(filename);
NSString *path = [NSString stringWithCString:pathStr.c_str()
void NativeWindowMac::PreviewFile(const std::string& filepath, const std::string& filename) {
NSString *path = [NSString stringWithCString:filepath.c_str()
encoding:[NSString defaultCStringEncoding]];
NSString *name = [NSString stringWithCString:nameStr.c_str()
NSString *name = [NSString stringWithCString:filename.c_str()
encoding:[NSString defaultCStringEncoding]];
[window_ previewFileAtPath:path withName:name];