OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <ApplicationServices/ApplicationServices.h> | 5 #include <ApplicationServices/ApplicationServices.h> |
6 #import <Cocoa/Cocoa.h> | 6 #import <Cocoa/Cocoa.h> |
7 #import <objc/objc-runtime.h> | 7 #import <objc/objc-runtime.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 | 9 |
10 #include "webkit/tools/test_shell/test_shell.h" | 10 #include "webkit/tools/test_shell/test_shell.h" |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
547 navigation_controller_->LoadEntry( | 547 navigation_controller_->LoadEntry( |
548 new TestNavigationEntry(-1, url, frame_name)); | 548 new TestNavigationEntry(-1, url, frame_name)); |
549 } | 549 } |
550 | 550 |
551 bool TestShell::PromptForSaveFile(const wchar_t* prompt_title, | 551 bool TestShell::PromptForSaveFile(const wchar_t* prompt_title, |
552 FilePath* result) | 552 FilePath* result) |
553 { | 553 { |
554 NSSavePanel* save_panel = [NSSavePanel savePanel]; | 554 NSSavePanel* save_panel = [NSSavePanel savePanel]; |
555 | 555 |
556 /* set up new attributes */ | 556 /* set up new attributes */ |
557 [save_panel setRequiredFileType:@"txt"]; | 557 [save_panel setAllowedFileTypes:@[@"txt"]]; |
Robert Sesek
2012/08/01 15:22:30
Snazzy.
| |
558 [save_panel setMessage: | 558 [save_panel setMessage: |
559 [NSString stringWithUTF8String:WideToUTF8(prompt_title).c_str()]]; | 559 [NSString stringWithUTF8String:WideToUTF8(prompt_title).c_str()]]; |
560 | 560 |
561 /* display the NSSavePanel */ | 561 /* display the NSSavePanel */ |
562 if ([save_panel runModalForDirectory:NSHomeDirectory() file:@""] == | 562 [save_panel setDirectoryURL:[NSURL fileURLWithPath:NSHomeDirectory()]]; |
563 NSOKButton) { | 563 [save_panel setNameFieldStringValue:@""]; |
564 *result = FilePath([[save_panel filename] fileSystemRepresentation]); | 564 if ([save_panel runModal] == NSFileHandlingPanelOKButton) { |
565 *result = FilePath([[[save_panel URL] path] fileSystemRepresentation]); | |
565 return true; | 566 return true; |
566 } | 567 } |
567 return false; | 568 return false; |
568 } | 569 } |
569 | 570 |
570 // static | 571 // static |
571 std::string TestShell::RewriteLocalUrl(const std::string& url) { | 572 std::string TestShell::RewriteLocalUrl(const std::string& url) { |
572 // Convert file:///tmp/LayoutTests urls to the actual location on disk. | 573 // Convert file:///tmp/LayoutTests urls to the actual location on disk. |
573 const char kPrefix[] = "file:///tmp/LayoutTests/"; | 574 const char kPrefix[] = "file:///tmp/LayoutTests/"; |
574 const int kPrefixLen = arraysize(kPrefix) - 1; | 575 const int kPrefixLen = arraysize(kPrefix) - 1; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
694 return false; | 695 return false; |
695 } | 696 } |
696 | 697 |
697 void DidLoadPlugin(const std::string& filename) { | 698 void DidLoadPlugin(const std::string& filename) { |
698 } | 699 } |
699 | 700 |
700 void DidUnloadPlugin(const std::string& filename) { | 701 void DidUnloadPlugin(const std::string& filename) { |
701 } | 702 } |
702 | 703 |
703 } // namespace webkit_glue | 704 } // namespace webkit_glue |
OLD | NEW |