| 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 "webkit/tools/test_shell/test_shell.h" | 5 #include "webkit/tools/test_shell/test_shell.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <commdlg.h> | 8 #include <commdlg.h> |
| 9 #include <objbase.h> | 9 #include <objbase.h> |
| 10 #include <process.h> | 10 #include <process.h> |
| 11 #include <shlwapi.h> | 11 #include <shlwapi.h> |
| 12 | 12 |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/debug/trace_event.h" | 14 #include "base/debug/trace_event.h" |
| 15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/stack_container.h" | 18 #include "base/stack_container.h" |
| 19 #include "base/string_piece.h" | 19 #include "base/string_piece.h" |
| 20 #include "base/string_util.h" | 20 #include "base/string_util.h" |
| 21 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
| 22 #include "base/win/resource_util.h" | 22 #include "base/win/resource_util.h" |
| 23 #include "breakpad/src/client/windows/handler/exception_handler.h" | 23 #include "breakpad/src/client/windows/handler/exception_handler.h" |
| 24 #include "grit/webkit_chromium_resources.h" |
| 24 #include "grit/webkit_resources.h" | 25 #include "grit/webkit_resources.h" |
| 25 #include "grit/webkit_chromium_resources.h" | |
| 26 #include "net/base/net_module.h" | 26 #include "net/base/net_module.h" |
| 27 #include "net/url_request/url_request_file_job.h" | 27 #include "net/url_request/url_request_file_job.h" |
| 28 #include "skia/ext/bitmap_platform_device.h" | 28 #include "skia/ext/bitmap_platform_device.h" |
| 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 31 #include "ui/base/win/hwnd_util.h" | 31 #include "ui/base/win/hwnd_util.h" |
| 32 #include "webkit/glue/webkit_glue.h" | 32 #include "webkit/glue/webkit_glue.h" |
| 33 #include "webkit/glue/webpreferences.h" | 33 #include "webkit/glue/webpreferences.h" |
| 34 #include "webkit/plugins/npapi/plugin_list.h" | 34 #include "webkit/plugins/npapi/plugin_list.h" |
| 35 #include "webkit/tools/test_shell/resource.h" | 35 #include "webkit/tools/test_shell/resource.h" |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 wchar_t localized[MAX_LOADSTRING]; | 662 wchar_t localized[MAX_LOADSTRING]; |
| 663 int length = LoadString(GetModuleHandle(NULL), message_id, | 663 int length = LoadString(GetModuleHandle(NULL), message_id, |
| 664 localized, MAX_LOADSTRING); | 664 localized, MAX_LOADSTRING); |
| 665 if (!length && GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND) { | 665 if (!length && GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND) { |
| 666 NOTREACHED(); | 666 NOTREACHED(); |
| 667 return L"No string for this identifier!"; | 667 return L"No string for this identifier!"; |
| 668 } | 668 } |
| 669 return string16(localized, length); | 669 return string16(localized, length); |
| 670 } | 670 } |
| 671 | 671 |
| 672 base::StringPiece TestShellWebKitInit::GetDataResource(int resource_id) { | |
| 673 return base::StringPiece(); | |
| 674 } | |
| 675 | |
| 676 // TODO(tc): Convert this to using resources from test_shell.rc. | 672 // TODO(tc): Convert this to using resources from test_shell.rc. |
| 677 base::StringPiece TestShellWebKitInit::GetImageResource(int resource_id, | 673 base::StringPiece TestShellWebKitInit::GetDataResource( |
| 678 float scale_factor) { | 674 int resource_id, |
| 675 ui::ScaleFactor scale_factor) { |
| 679 switch (resource_id) { | 676 switch (resource_id) { |
| 680 case IDR_BROKENIMAGE: { | 677 case IDR_BROKENIMAGE: { |
| 681 // Use webkit's broken image icon (16x16) | 678 // Use webkit's broken image icon (16x16) |
| 682 static std::string broken_image_data; | 679 static std::string broken_image_data; |
| 683 if (broken_image_data.empty()) { | 680 if (broken_image_data.empty()) { |
| 684 FilePath path = GetResourcesFilePath(); | 681 FilePath path = GetResourcesFilePath(); |
| 685 path = path.AppendASCII("missingImage.gif"); | 682 path = path.AppendASCII("missingImage.gif"); |
| 686 bool success = file_util::ReadFileToString(path, &broken_image_data); | 683 bool success = file_util::ReadFileToString(path, &broken_image_data); |
| 687 if (!success) { | 684 if (!success) { |
| 688 LOG(FATAL) << "Failed reading: " << path.value(); | 685 LOG(FATAL) << "Failed reading: " << path.value(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 | 733 |
| 737 bool EnsureFontLoaded(HFONT font) { | 734 bool EnsureFontLoaded(HFONT font) { |
| 738 return true; | 735 return true; |
| 739 } | 736 } |
| 740 | 737 |
| 741 bool DownloadUrl(const std::string& url, HWND caller_window) { | 738 bool DownloadUrl(const std::string& url, HWND caller_window) { |
| 742 return false; | 739 return false; |
| 743 } | 740 } |
| 744 | 741 |
| 745 } // namespace webkit_glue | 742 } // namespace webkit_glue |
| OLD | NEW |