Changing names and memory leak fix

This commit is contained in:
Pierre Laurac 2016-10-14 09:42:50 -07:00 committed by Kevin Sawicki
parent 6bac17fb9a
commit 9b19e6ee38
6 changed files with 18 additions and 18 deletions

View file

@ -729,12 +729,12 @@ void Window::SetAspectRatio(double aspect_ratio, mate::Arguments* args) {
window_->SetAspectRatio(aspect_ratio, extra_size); window_->SetAspectRatio(aspect_ratio, extra_size);
} }
void Window::PreviewFile(const std::string& filepath, mate::Arguments* args) { void Window::PreviewFile(const std::string& path, mate::Arguments* args) {
std::string filename; std::string fileName;
if (!args->GetNext(&filename)) { if (!args->GetNext(&fileName)) {
filename = filepath; fileName = path;
} }
window_->PreviewFile(filepath, filename); window_->PreviewFile(path, fileName);
} }
void Window::SetParentWindow(v8::Local<v8::Value> value, void Window::SetParentWindow(v8::Local<v8::Value> value,

View file

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

View file

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

View file

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

View file

@ -55,7 +55,7 @@ class NativeWindowMac : public NativeWindow,
void SetMovable(bool movable) override; void SetMovable(bool movable) override;
void SetAspectRatio(double aspect_ratio, const gfx::Size& extra_size) void SetAspectRatio(double aspect_ratio, const gfx::Size& extra_size)
override; override;
void PreviewFile(const std::string& filepath, const std::string& filename) void PreviewFile(const std::string& path, const std::string& fileName)
override; override;
bool IsMovable() override; bool IsMovable() override;
void SetMinimizable(bool minimizable) override; void SetMinimizable(bool minimizable) override;

View file

@ -492,9 +492,9 @@ bool ScopedDisableResize::disable_resize_ = false;
return [self quickLookItem]; return [self quickLookItem];
} }
- (void)previewFileAtPath:(NSString *)filepath withName:(NSString *) name { - (void)previewFileAtPath:(NSString *)path withName:(NSString *) fileName {
NSURL * url = [[NSURL alloc] initFileURLWithPath:filepath]; NSURL * url = [[[NSURL alloc] initFileURLWithPath:path] autorelease];
[self setQuickLookItem:[[AtomPreviewItem alloc] initWithURL:url title:name]]; [self setQuickLookItem:[[[AtomPreviewItem alloc] initWithURL:url title:fileName] autorelease]];
[[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFront:nil]; [[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFront:nil];
} }
@ -953,11 +953,11 @@ void NativeWindowMac::SetAspectRatio(double aspect_ratio,
[window_ setResizeIncrements:NSMakeSize(1.0, 1.0)]; [window_ setResizeIncrements:NSMakeSize(1.0, 1.0)];
} }
void NativeWindowMac::PreviewFile(const std::string& filepath, const std::string& filename) { void NativeWindowMac::PreviewFile(const std::string& path, const std::string& fileName) {
NSString *path = [NSString stringWithUTF8String:filepath.c_str()]; NSString *pathStr = [NSString stringWithUTF8String:path.c_str()];
NSString *name = [NSString stringWithUTF8String:filename.c_str()]; NSString *nameStr = [NSString stringWithUTF8String:fileName.c_str()];
[window_ previewFileAtPath:path withName:name]; [window_ previewFileAtPath:pathStr withName:nameStr];
} }
void NativeWindowMac::SetMovable(bool movable) { void NativeWindowMac::SetMovable(bool movable) {