| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 static base::StringPiece GetRawDataResource(HMODULE module, int resource_id) { | 132 static base::StringPiece GetRawDataResource(HMODULE module, int resource_id) { |
| 133 void* data_ptr; | 133 void* data_ptr; |
| 134 size_t data_size; | 134 size_t data_size; |
| 135 return base::GetDataResourceFromModule(module, resource_id, &data_ptr, | 135 return base::GetDataResourceFromModule(module, resource_id, &data_ptr, |
| 136 &data_size) | 136 &data_size) |
| 137 ? base::StringPiece(static_cast<char*>(data_ptr), data_size) | 137 ? base::StringPiece(static_cast<char*>(data_ptr), data_size) |
| 138 : base::StringPiece(); | 138 : base::StringPiece(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 // This is called indirectly by the network layer to access resources. | |
| 142 base::StringPiece NetResourceProvider(int key) { | |
| 143 return GetRawDataResource(::GetModuleHandle(NULL), key); | |
| 144 } | |
| 145 | |
| 146 } // namespace | 141 } // namespace |
| 147 | 142 |
| 148 // Initialize static member variable | 143 // Initialize static member variable |
| 149 HINSTANCE TestShell::instance_handle_; | 144 HINSTANCE TestShell::instance_handle_; |
| 150 | 145 |
| 151 ///////////////////////////////////////////////////////////////////////////// | 146 ///////////////////////////////////////////////////////////////////////////// |
| 152 // static methods on TestShell | 147 // static methods on TestShell |
| 153 | 148 |
| 154 const MINIDUMP_TYPE kFullDumpType = static_cast<MINIDUMP_TYPE>( | 149 const MINIDUMP_TYPE kFullDumpType = static_cast<MINIDUMP_TYPE>( |
| 155 MiniDumpWithFullMemory | // Full memory from process. | 150 MiniDumpWithFullMemory | // Full memory from process. |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 *result = FilePath(info.lpstrFile); | 727 *result = FilePath(info.lpstrFile); |
| 733 return true; | 728 return true; |
| 734 } | 729 } |
| 735 | 730 |
| 736 // static | 731 // static |
| 737 void TestShell::ShowStartupDebuggingDialog() { | 732 void TestShell::ShowStartupDebuggingDialog() { |
| 738 MessageBox(NULL, L"attach to me?", L"test_shell", MB_OK); | 733 MessageBox(NULL, L"attach to me?", L"test_shell", MB_OK); |
| 739 } | 734 } |
| 740 | 735 |
| 741 // static | 736 // static |
| 742 base::StringPiece TestShell::NetResourceProvider(int key) { | 737 base::StringPiece TestShell::ResourceProvider(int key) { |
| 743 return GetRawDataResource(::GetModuleHandle(NULL), key); | 738 return GetRawDataResource(::GetModuleHandle(NULL), key); |
| 744 } | 739 } |
| 745 | 740 |
| 746 | 741 |
| 747 ///////////////////////////////////////////////////////////////////////////// | 742 ///////////////////////////////////////////////////////////////////////////// |
| 748 // WebKit glue functions | 743 // WebKit glue functions |
| 749 | 744 |
| 750 namespace webkit_glue { | 745 namespace webkit_glue { |
| 751 | 746 |
| 752 string16 GetLocalizedString(int message_id) { | 747 string16 GetLocalizedString(int message_id) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 case IDR_MEDIA_PLAY_BUTTON_DISABLED: | 794 case IDR_MEDIA_PLAY_BUTTON_DISABLED: |
| 800 case IDR_MEDIA_SOUND_FULL_BUTTON: | 795 case IDR_MEDIA_SOUND_FULL_BUTTON: |
| 801 case IDR_MEDIA_SOUND_NONE_BUTTON: | 796 case IDR_MEDIA_SOUND_NONE_BUTTON: |
| 802 case IDR_MEDIA_SOUND_DISABLED: | 797 case IDR_MEDIA_SOUND_DISABLED: |
| 803 case IDR_MEDIA_SLIDER_THUMB: | 798 case IDR_MEDIA_SLIDER_THUMB: |
| 804 case IDR_MEDIA_VOLUME_SLIDER_THUMB: | 799 case IDR_MEDIA_VOLUME_SLIDER_THUMB: |
| 805 case IDR_DEVTOOLS_DEBUGGER_SCRIPT_JS: | 800 case IDR_DEVTOOLS_DEBUGGER_SCRIPT_JS: |
| 806 case IDR_INPUT_SPEECH: | 801 case IDR_INPUT_SPEECH: |
| 807 case IDR_INPUT_SPEECH_RECORDING: | 802 case IDR_INPUT_SPEECH_RECORDING: |
| 808 case IDR_INPUT_SPEECH_WAITING: | 803 case IDR_INPUT_SPEECH_WAITING: |
| 809 return NetResourceProvider(resource_id); | 804 return TestShell::ResourceProvider(resource_id); |
| 810 | 805 |
| 811 default: | 806 default: |
| 812 break; | 807 break; |
| 813 } | 808 } |
| 814 | 809 |
| 815 return base::StringPiece(); | 810 return base::StringPiece(); |
| 816 } | 811 } |
| 817 | 812 |
| 818 HCURSOR LoadCursor(int cursor_id) { | 813 HCURSOR LoadCursor(int cursor_id) { |
| 819 return NULL; | 814 return NULL; |
| 820 } | 815 } |
| 821 | 816 |
| 822 bool EnsureFontLoaded(HFONT font) { | 817 bool EnsureFontLoaded(HFONT font) { |
| 823 return true; | 818 return true; |
| 824 } | 819 } |
| 825 | 820 |
| 826 bool DownloadUrl(const std::string& url, HWND caller_window) { | 821 bool DownloadUrl(const std::string& url, HWND caller_window) { |
| 827 return false; | 822 return false; |
| 828 } | 823 } |
| 829 | 824 |
| 830 } // namespace webkit_glue | 825 } // namespace webkit_glue |
| OLD | NEW |