| 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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 *result = FilePath(info.lpstrFile); | 728 *result = FilePath(info.lpstrFile); |
| 734 return true; | 729 return true; |
| 735 } | 730 } |
| 736 | 731 |
| 737 // static | 732 // static |
| 738 void TestShell::ShowStartupDebuggingDialog() { | 733 void TestShell::ShowStartupDebuggingDialog() { |
| 739 MessageBox(NULL, L"attach to me?", L"test_shell", MB_OK); | 734 MessageBox(NULL, L"attach to me?", L"test_shell", MB_OK); |
| 740 } | 735 } |
| 741 | 736 |
| 742 // static | 737 // static |
| 743 base::StringPiece TestShell::NetResourceProvider(int key) { | 738 base::StringPiece TestShell::ResourceProvider(int key) { |
| 744 return GetRawDataResource(::GetModuleHandle(NULL), key); | 739 return GetRawDataResource(::GetModuleHandle(NULL), key); |
| 745 } | 740 } |
| 746 | 741 |
| 747 | 742 |
| 748 ///////////////////////////////////////////////////////////////////////////// | 743 ///////////////////////////////////////////////////////////////////////////// |
| 749 // WebKit glue functions | 744 // WebKit glue functions |
| 750 | 745 |
| 751 namespace webkit_glue { | 746 namespace webkit_glue { |
| 752 | 747 |
| 753 string16 GetLocalizedString(int message_id) { | 748 string16 GetLocalizedString(int message_id) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 case IDR_MEDIA_PLAY_BUTTON_DISABLED: | 795 case IDR_MEDIA_PLAY_BUTTON_DISABLED: |
| 801 case IDR_MEDIA_SOUND_FULL_BUTTON: | 796 case IDR_MEDIA_SOUND_FULL_BUTTON: |
| 802 case IDR_MEDIA_SOUND_NONE_BUTTON: | 797 case IDR_MEDIA_SOUND_NONE_BUTTON: |
| 803 case IDR_MEDIA_SOUND_DISABLED: | 798 case IDR_MEDIA_SOUND_DISABLED: |
| 804 case IDR_MEDIA_SLIDER_THUMB: | 799 case IDR_MEDIA_SLIDER_THUMB: |
| 805 case IDR_MEDIA_VOLUME_SLIDER_THUMB: | 800 case IDR_MEDIA_VOLUME_SLIDER_THUMB: |
| 806 case IDR_DEVTOOLS_DEBUGGER_SCRIPT_JS: | 801 case IDR_DEVTOOLS_DEBUGGER_SCRIPT_JS: |
| 807 case IDR_INPUT_SPEECH: | 802 case IDR_INPUT_SPEECH: |
| 808 case IDR_INPUT_SPEECH_RECORDING: | 803 case IDR_INPUT_SPEECH_RECORDING: |
| 809 case IDR_INPUT_SPEECH_WAITING: | 804 case IDR_INPUT_SPEECH_WAITING: |
| 810 return NetResourceProvider(resource_id); | 805 return TestShell::ResourceProvider(resource_id); |
| 811 | 806 |
| 812 default: | 807 default: |
| 813 break; | 808 break; |
| 814 } | 809 } |
| 815 | 810 |
| 816 return base::StringPiece(); | 811 return base::StringPiece(); |
| 817 } | 812 } |
| 818 | 813 |
| 819 HCURSOR LoadCursor(int cursor_id) { | 814 HCURSOR LoadCursor(int cursor_id) { |
| 820 return NULL; | 815 return NULL; |
| 821 } | 816 } |
| 822 | 817 |
| 823 bool EnsureFontLoaded(HFONT font) { | 818 bool EnsureFontLoaded(HFONT font) { |
| 824 return true; | 819 return true; |
| 825 } | 820 } |
| 826 | 821 |
| 827 bool DownloadUrl(const std::string& url, HWND caller_window) { | 822 bool DownloadUrl(const std::string& url, HWND caller_window) { |
| 828 return false; | 823 return false; |
| 829 } | 824 } |
| 830 | 825 |
| 831 } // namespace webkit_glue | 826 } // namespace webkit_glue |
| OLD | NEW |