Browse Source

Using string from the std

Pierre Laurac 8 years ago
parent
commit
9673cee4d7

+ 1 - 1
atom/browser/api/atom_api_window.cc

@@ -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);
 }
 

+ 1 - 1
atom/browser/api/atom_api_window.h

@@ -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;

+ 1 - 1
atom/browser/native_window.cc

@@ -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() {

+ 1 - 1
atom/browser/native_window.h

@@ -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();

+ 2 - 2
atom/browser/native_window_mac.h

@@ -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;

+ 3 - 6
atom/browser/native_window_mac.mm

@@ -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];