| 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 "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> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 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" |
| 36 #include "webkit/tools/test_shell/test_navigation_controller.h" | 36 #include "webkit/tools/test_shell/test_navigation_controller.h" |
| 37 #include "webkit/tools/test_shell/test_shell_devtools_agent.h" | 37 #include "webkit/tools/test_shell/test_shell_devtools_agent.h" |
| 38 #include "webkit/tools/test_shell/test_shell_switches.h" | 38 #include "webkit/tools/test_shell/test_shell_switches.h" |
| 39 #include "webkit/tools/test_shell/test_shell_webkit_init.h" |
| 39 #include "webkit/tools/test_shell/test_webview_delegate.h" | 40 #include "webkit/tools/test_shell/test_webview_delegate.h" |
| 40 | 41 |
| 41 using WebKit::WebWidget; | 42 using WebKit::WebWidget; |
| 42 | 43 |
| 43 #define MAX_LOADSTRING 100 | 44 #define MAX_LOADSTRING 100 |
| 44 | 45 |
| 45 #define BUTTON_WIDTH 72 | 46 #define BUTTON_WIDTH 72 |
| 46 #define URLBAR_HEIGHT 24 | 47 #define URLBAR_HEIGHT 24 |
| 47 | 48 |
| 48 // Global Variables: | 49 // Global Variables: |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 void TestShell::ShowStartupDebuggingDialog() { | 651 void TestShell::ShowStartupDebuggingDialog() { |
| 651 MessageBox(NULL, L"attach to me?", L"test_shell", MB_OK); | 652 MessageBox(NULL, L"attach to me?", L"test_shell", MB_OK); |
| 652 } | 653 } |
| 653 | 654 |
| 654 // static | 655 // static |
| 655 base::StringPiece TestShell::ResourceProvider(int key) { | 656 base::StringPiece TestShell::ResourceProvider(int key) { |
| 656 return GetRawDataResource(::GetModuleHandle(NULL), key); | 657 return GetRawDataResource(::GetModuleHandle(NULL), key); |
| 657 } | 658 } |
| 658 | 659 |
| 659 | 660 |
| 660 ///////////////////////////////////////////////////////////////////////////// | 661 string16 TestShellWebKitInit::GetLocalizedString(int message_id) { |
| 661 // WebKit glue functions | |
| 662 | |
| 663 namespace webkit_glue { | |
| 664 | |
| 665 string16 GetLocalizedString(int message_id) { | |
| 666 wchar_t localized[MAX_LOADSTRING]; | 662 wchar_t localized[MAX_LOADSTRING]; |
| 667 int length = LoadString(GetModuleHandle(NULL), message_id, | 663 int length = LoadString(GetModuleHandle(NULL), message_id, |
| 668 localized, MAX_LOADSTRING); | 664 localized, MAX_LOADSTRING); |
| 669 if (!length && GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND) { | 665 if (!length && GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND) { |
| 670 NOTREACHED(); | 666 NOTREACHED(); |
| 671 return L"No string for this identifier!"; | 667 return L"No string for this identifier!"; |
| 672 } | 668 } |
| 673 return string16(localized, length); | 669 return string16(localized, length); |
| 674 } | 670 } |
| 675 | 671 |
| 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 GetDataResource(int resource_id) { | 673 base::StringPiece TestShellWebKitInit::GetDataResource(int resource_id) { |
| 678 switch (resource_id) { | 674 switch (resource_id) { |
| 679 case IDR_BROKENIMAGE: { | 675 case IDR_BROKENIMAGE: { |
| 680 // Use webkit's broken image icon (16x16) | 676 // Use webkit's broken image icon (16x16) |
| 681 static std::string broken_image_data; | 677 static std::string broken_image_data; |
| 682 if (broken_image_data.empty()) { | 678 if (broken_image_data.empty()) { |
| 683 FilePath path = GetResourcesFilePath(); | 679 FilePath path = GetResourcesFilePath(); |
| 684 path = path.AppendASCII("missingImage.gif"); | 680 path = path.AppendASCII("missingImage.gif"); |
| 685 bool success = file_util::ReadFileToString(path, &broken_image_data); | 681 bool success = file_util::ReadFileToString(path, &broken_image_data); |
| 686 if (!success) { | 682 if (!success) { |
| 687 LOG(FATAL) << "Failed reading: " << path.value(); | 683 LOG(FATAL) << "Failed reading: " << path.value(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 case IDR_INPUT_SPEECH_WAITING: | 716 case IDR_INPUT_SPEECH_WAITING: |
| 721 return TestShell::ResourceProvider(resource_id); | 717 return TestShell::ResourceProvider(resource_id); |
| 722 | 718 |
| 723 default: | 719 default: |
| 724 break; | 720 break; |
| 725 } | 721 } |
| 726 | 722 |
| 727 return base::StringPiece(); | 723 return base::StringPiece(); |
| 728 } | 724 } |
| 729 | 725 |
| 726 ///////////////////////////////////////////////////////////////////////////// |
| 727 // WebKit glue functions |
| 728 |
| 729 namespace webkit_glue { |
| 730 |
| 730 bool EnsureFontLoaded(HFONT font) { | 731 bool EnsureFontLoaded(HFONT font) { |
| 731 return true; | 732 return true; |
| 732 } | 733 } |
| 733 | 734 |
| 734 bool DownloadUrl(const std::string& url, HWND caller_window) { | 735 bool DownloadUrl(const std::string& url, HWND caller_window) { |
| 735 return false; | 736 return false; |
| 736 } | 737 } |
| 737 | 738 |
| 738 } // namespace webkit_glue | 739 } // namespace webkit_glue |
| OLD | NEW |