Chromium Code Reviews| 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. | 141 // This is called indirectly by the network layer to access resources. |
|
tony
2011/01/14 22:06:04
We actually call TestShell::ResourceProvider, don'
xiyuan
2011/01/18 21:30:49
Yep, you are right. Removed as suggested.
| |
| 142 base::StringPiece NetResourceProvider(int key) { | 142 base::StringPiece ResourceProvider(int key) { |
| 143 return GetRawDataResource(::GetModuleHandle(NULL), key); | 143 return GetRawDataResource(::GetModuleHandle(NULL), key); |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace | 146 } // namespace |
| 147 | 147 |
| 148 // Initialize static member variable | 148 // Initialize static member variable |
| 149 HINSTANCE TestShell::instance_handle_; | 149 HINSTANCE TestShell::instance_handle_; |
| 150 | 150 |
| 151 ///////////////////////////////////////////////////////////////////////////// | 151 ///////////////////////////////////////////////////////////////////////////// |
| 152 // static methods on TestShell | 152 // static methods on TestShell |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 733 *result = FilePath(info.lpstrFile); | 733 *result = FilePath(info.lpstrFile); |
| 734 return true; | 734 return true; |
| 735 } | 735 } |
| 736 | 736 |
| 737 // static | 737 // static |
| 738 void TestShell::ShowStartupDebuggingDialog() { | 738 void TestShell::ShowStartupDebuggingDialog() { |
| 739 MessageBox(NULL, L"attach to me?", L"test_shell", MB_OK); | 739 MessageBox(NULL, L"attach to me?", L"test_shell", MB_OK); |
| 740 } | 740 } |
| 741 | 741 |
| 742 // static | 742 // static |
| 743 base::StringPiece TestShell::NetResourceProvider(int key) { | 743 base::StringPiece TestShell::ResourceProvider(int key) { |
| 744 return GetRawDataResource(::GetModuleHandle(NULL), key); | 744 return GetRawDataResource(::GetModuleHandle(NULL), key); |
| 745 } | 745 } |
| 746 | 746 |
| 747 | 747 |
| 748 ///////////////////////////////////////////////////////////////////////////// | 748 ///////////////////////////////////////////////////////////////////////////// |
| 749 // WebKit glue functions | 749 // WebKit glue functions |
| 750 | 750 |
| 751 namespace webkit_glue { | 751 namespace webkit_glue { |
| 752 | 752 |
| 753 string16 GetLocalizedString(int message_id) { | 753 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: | 800 case IDR_MEDIA_PLAY_BUTTON_DISABLED: |
| 801 case IDR_MEDIA_SOUND_FULL_BUTTON: | 801 case IDR_MEDIA_SOUND_FULL_BUTTON: |
| 802 case IDR_MEDIA_SOUND_NONE_BUTTON: | 802 case IDR_MEDIA_SOUND_NONE_BUTTON: |
| 803 case IDR_MEDIA_SOUND_DISABLED: | 803 case IDR_MEDIA_SOUND_DISABLED: |
| 804 case IDR_MEDIA_SLIDER_THUMB: | 804 case IDR_MEDIA_SLIDER_THUMB: |
| 805 case IDR_MEDIA_VOLUME_SLIDER_THUMB: | 805 case IDR_MEDIA_VOLUME_SLIDER_THUMB: |
| 806 case IDR_DEVTOOLS_DEBUGGER_SCRIPT_JS: | 806 case IDR_DEVTOOLS_DEBUGGER_SCRIPT_JS: |
| 807 case IDR_INPUT_SPEECH: | 807 case IDR_INPUT_SPEECH: |
| 808 case IDR_INPUT_SPEECH_RECORDING: | 808 case IDR_INPUT_SPEECH_RECORDING: |
| 809 case IDR_INPUT_SPEECH_WAITING: | 809 case IDR_INPUT_SPEECH_WAITING: |
| 810 return NetResourceProvider(resource_id); | 810 return ResourceProvider(resource_id); |
|
tony
2011/01/14 22:06:04
Can we just call TestShell::ResourceProvider here
xiyuan
2011/01/18 21:30:49
Done.
| |
| 811 | 811 |
| 812 default: | 812 default: |
| 813 break; | 813 break; |
| 814 } | 814 } |
| 815 | 815 |
| 816 return base::StringPiece(); | 816 return base::StringPiece(); |
| 817 } | 817 } |
| 818 | 818 |
| 819 HCURSOR LoadCursor(int cursor_id) { | 819 HCURSOR LoadCursor(int cursor_id) { |
| 820 return NULL; | 820 return NULL; |
| 821 } | 821 } |
| 822 | 822 |
| 823 bool EnsureFontLoaded(HFONT font) { | 823 bool EnsureFontLoaded(HFONT font) { |
| 824 return true; | 824 return true; |
| 825 } | 825 } |
| 826 | 826 |
| 827 bool DownloadUrl(const std::string& url, HWND caller_window) { | 827 bool DownloadUrl(const std::string& url, HWND caller_window) { |
| 828 return false; | 828 return false; |
| 829 } | 829 } |
| 830 | 830 |
| 831 } // namespace webkit_glue | 831 } // namespace webkit_glue |
| OLD | NEW |