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);
}
void Window::PreviewFile(const std::string& filepath, mate::Arguments* args) {
std::string filename;
if (!args->GetNext(&filename)) {
filename = filepath;
void Window::PreviewFile(const std::string& path, mate::Arguments* args) {
std::string fileName;
if (!args->GetNext(&fileName)) {
fileName = path;
}
window_->PreviewFile(filepath, filename);
window_->PreviewFile(path, fileName);
}
void Window::SetParentWindow(v8::Local<v8::Value> value,

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 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);
v8::Local<v8::Value> GetParentWindow() 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;
}
void NativeWindow::PreviewFile(const std::string& filepath,
const std::string& filename) {
void NativeWindow::PreviewFile(const std::string& path,
const std::string& fileName) {
}
void NativeWindow::RequestToClosePage() {

View file

@ -176,8 +176,8 @@ 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 std::string& filepath,
const std::string& filename);
virtual void PreviewFile(const std::string& path,
const std::string& fileName);
base::WeakPtr<NativeWindow> GetWeakPtr() {
return weak_factory_.GetWeakPtr();

View file

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

View file

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