| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 20 matching lines...) Expand all Loading... |
| 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 32 #include "ui/base/resource/data_pack.h" | 32 #include "ui/base/resource/data_pack.h" |
| 33 #include "ui/gfx/size.h" | 33 #include "ui/gfx/size.h" |
| 34 #include "webkit/glue/webkit_glue.h" | 34 #include "webkit/glue/webkit_glue.h" |
| 35 #include "webkit/glue/webpreferences.h" | 35 #include "webkit/glue/webpreferences.h" |
| 36 #include "webkit/plugins/npapi/plugin_list.h" | 36 #include "webkit/plugins/npapi/plugin_list.h" |
| 37 #include "webkit/tools/test_shell/mac/test_shell_webview.h" | 37 #include "webkit/tools/test_shell/mac/test_shell_webview.h" |
| 38 #include "webkit/tools/test_shell/resource.h" | 38 #include "webkit/tools/test_shell/resource.h" |
| 39 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" | 39 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |
| 40 #include "webkit/tools/test_shell/test_navigation_controller.h" | 40 #include "webkit/tools/test_shell/test_navigation_controller.h" |
| 41 #include "webkit/tools/test_shell/test_shell_webkit_init.h" |
| 41 #include "webkit/tools/test_shell/test_webview_delegate.h" | 42 #include "webkit/tools/test_shell/test_webview_delegate.h" |
| 42 | 43 |
| 43 #include "third_party/skia/include/core/SkBitmap.h" | 44 #include "third_party/skia/include/core/SkBitmap.h" |
| 44 | 45 |
| 45 #import "mac/DumpRenderTreePasteboard.h" | 46 #import "mac/DumpRenderTreePasteboard.h" |
| 46 | 47 |
| 47 using WebKit::WebWidget; | 48 using WebKit::WebWidget; |
| 48 | 49 |
| 49 #define MAX_LOADSTRING 100 | 50 #define MAX_LOADSTRING 100 |
| 50 | 51 |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 } | 598 } |
| 598 | 599 |
| 599 base::StringPiece TestShell::ResourceProvider(int key) { | 600 base::StringPiece TestShell::ResourceProvider(int key) { |
| 600 base::StringPiece res; | 601 base::StringPiece res; |
| 601 g_resource_data_pack->GetStringPiece(key, &res); | 602 g_resource_data_pack->GetStringPiece(key, &res); |
| 602 return res; | 603 return res; |
| 603 } | 604 } |
| 604 | 605 |
| 605 //----------------------------------------------------------------------------- | 606 //----------------------------------------------------------------------------- |
| 606 | 607 |
| 607 namespace webkit_glue { | 608 string16 TestShellWebKitInit::GetLocalizedString(int message_id) { |
| 608 | |
| 609 string16 GetLocalizedString(int message_id) { | |
| 610 base::StringPiece res; | 609 base::StringPiece res; |
| 611 if (!g_resource_data_pack->GetStringPiece(message_id, &res)) { | 610 if (!g_resource_data_pack->GetStringPiece(message_id, &res)) { |
| 612 LOG(FATAL) << "failed to load webkit string with id " << message_id; | 611 LOG(FATAL) << "failed to load webkit string with id " << message_id; |
| 613 } | 612 } |
| 614 | 613 |
| 615 // Data packs hold strings as either UTF8 or UTF16. | 614 // Data packs hold strings as either UTF8 or UTF16. |
| 616 string16 msg; | 615 string16 msg; |
| 617 switch (g_resource_data_pack->GetTextEncodingType()) { | 616 switch (g_resource_data_pack->GetTextEncodingType()) { |
| 618 case ui::DataPack::UTF8: | 617 case ui::DataPack::UTF8: |
| 619 msg = UTF8ToUTF16(res); | 618 msg = UTF8ToUTF16(res); |
| 620 break; | 619 break; |
| 621 case ui::DataPack::UTF16: | 620 case ui::DataPack::UTF16: |
| 622 msg = string16(reinterpret_cast<const char16*>(res.data()), | 621 msg = string16(reinterpret_cast<const char16*>(res.data()), |
| 623 res.length() / 2); | 622 res.length() / 2); |
| 624 break; | 623 break; |
| 625 case ui::DataPack::BINARY: | 624 case ui::DataPack::BINARY: |
| 626 NOTREACHED(); | 625 NOTREACHED(); |
| 627 break; | 626 break; |
| 628 } | 627 } |
| 629 | 628 |
| 630 return msg; | 629 return msg; |
| 631 } | 630 } |
| 632 | 631 |
| 633 base::StringPiece GetDataResource(int resource_id) { | 632 base::StringPiece TestShellWebKitInit::GetDataResource(int resource_id) { |
| 634 switch (resource_id) { | 633 switch (resource_id) { |
| 635 case IDR_BROKENIMAGE: { | 634 case IDR_BROKENIMAGE: { |
| 636 // Use webkit's broken image icon (16x16) | 635 // Use webkit's broken image icon (16x16) |
| 637 static std::string broken_image_data; | 636 static std::string broken_image_data; |
| 638 if (broken_image_data.empty()) { | 637 if (broken_image_data.empty()) { |
| 639 FilePath path = GetResourcesFilePath(); | 638 FilePath path = GetResourcesFilePath(); |
| 640 // In order to match WebKit's colors for the missing image, we have to | 639 // In order to match WebKit's colors for the missing image, we have to |
| 641 // use a PNG. The GIF doesn't have the color range needed to correctly | 640 // use a PNG. The GIF doesn't have the color range needed to correctly |
| 642 // match the TIFF they use in Safari. | 641 // match the TIFF they use in Safari. |
| 643 path = path.AppendASCII("missingImage.png"); | 642 path = path.AppendASCII("missingImage.png"); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 case IDR_INPUT_SPEECH_WAITING: | 678 case IDR_INPUT_SPEECH_WAITING: |
| 680 return TestShell::ResourceProvider(resource_id); | 679 return TestShell::ResourceProvider(resource_id); |
| 681 | 680 |
| 682 default: | 681 default: |
| 683 break; | 682 break; |
| 684 } | 683 } |
| 685 | 684 |
| 686 return base::StringPiece(); | 685 return base::StringPiece(); |
| 687 } | 686 } |
| 688 | 687 |
| 688 namespace webkit_glue { |
| 689 |
| 689 bool DownloadUrl(const std::string& url, NSWindow* caller_window) { | 690 bool DownloadUrl(const std::string& url, NSWindow* caller_window) { |
| 690 return false; | 691 return false; |
| 691 } | 692 } |
| 692 | 693 |
| 693 void DidLoadPlugin(const std::string& filename) { | 694 void DidLoadPlugin(const std::string& filename) { |
| 694 } | 695 } |
| 695 | 696 |
| 696 void DidUnloadPlugin(const std::string& filename) { | 697 void DidUnloadPlugin(const std::string& filename) { |
| 697 } | 698 } |
| 698 | 699 |
| 699 } // namespace webkit_glue | 700 } // namespace webkit_glue |
| OLD | NEW |