| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <windows.h> | 5 #include <windows.h> |
| 6 #include <atlbase.h> | 6 #include <atlbase.h> |
| 7 #include <commdlg.h> | 7 #include <commdlg.h> |
| 8 #include <objbase.h> | 8 #include <objbase.h> |
| 9 #include <shlwapi.h> | 9 #include <shlwapi.h> |
| 10 #include <wininet.h> | 10 #include <wininet.h> |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 #define MAX_URL_LENGTH 1024 | 643 #define MAX_URL_LENGTH 1024 |
| 644 | 644 |
| 645 LRESULT CALLBACK TestShell::EditWndProc(HWND hwnd, UINT message, | 645 LRESULT CALLBACK TestShell::EditWndProc(HWND hwnd, UINT message, |
| 646 WPARAM wParam, LPARAM lParam) { | 646 WPARAM wParam, LPARAM lParam) { |
| 647 TestShell* shell = | 647 TestShell* shell = |
| 648 static_cast<TestShell*>(win_util::GetWindowUserData(hwnd)); | 648 static_cast<TestShell*>(win_util::GetWindowUserData(hwnd)); |
| 649 | 649 |
| 650 switch (message) { | 650 switch (message) { |
| 651 case WM_CHAR: | 651 case WM_CHAR: |
| 652 if (wParam == VK_RETURN) { | 652 if (wParam == VK_RETURN) { |
| 653 wchar_t strPtr[MAX_URL_LENGTH]; | 653 wchar_t strPtr[MAX_URL_LENGTH + 1]; // Leave room for adding a NULL; |
| 654 *((LPWORD)strPtr) = MAX_URL_LENGTH; | 654 *((LPWORD)strPtr) = MAX_URL_LENGTH; |
| 655 LRESULT strLen = SendMessage(hwnd, EM_GETLINE, 0, (LPARAM)strPtr); | 655 LRESULT strLen = SendMessage(hwnd, EM_GETLINE, 0, (LPARAM)strPtr); |
| 656 if (strLen > 0) | 656 if (strLen > 0) { |
| 657 strPtr[strLen] = 0; // EM_GETLINE doesn't NULL terminate. |
| 657 shell->LoadURL(strPtr); | 658 shell->LoadURL(strPtr); |
| 659 } |
| 658 | 660 |
| 659 return 0; | 661 return 0; |
| 660 } | 662 } |
| 661 } | 663 } |
| 662 | 664 |
| 663 return (LRESULT) CallWindowProc(shell->default_edit_wnd_proc_, hwnd, | 665 return (LRESULT) CallWindowProc(shell->default_edit_wnd_proc_, hwnd, |
| 664 message, wParam, lParam); | 666 message, wParam, lParam); |
| 665 } | 667 } |
| 666 | 668 |
| 667 | 669 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 | 764 |
| 763 bool EnsureFontLoaded(HFONT font) { | 765 bool EnsureFontLoaded(HFONT font) { |
| 764 return true; | 766 return true; |
| 765 } | 767 } |
| 766 | 768 |
| 767 bool DownloadUrl(const std::string& url, HWND caller_window) { | 769 bool DownloadUrl(const std::string& url, HWND caller_window) { |
| 768 return false; | 770 return false; |
| 769 } | 771 } |
| 770 | 772 |
| 771 } // namespace webkit_glue | 773 } // namespace webkit_glue |
| OLD | NEW |