Chromium Code Reviews| Index: chrome/browser/ui/views/frame/browser_frame_win.cc |
| =================================================================== |
| --- chrome/browser/ui/views/frame/browser_frame_win.cc (revision 151723) |
| +++ chrome/browser/ui/views/frame/browser_frame_win.cc (working copy) |
| @@ -489,11 +489,6 @@ |
| void BrowserFrameWin::HandleMetroNavSearchRequest(WPARAM w_param, |
| LPARAM l_param) { |
| - if (!base::win::IsMetroProcess()) { |
| - NOTREACHED() << "Received unexpected metro navigation request"; |
| - return; |
| - } |
| - |
| if (!w_param && !l_param) { |
| NOTREACHED() << "Invalid metro request parameters"; |
| return; |
| @@ -505,11 +500,27 @@ |
| GURL request_url; |
| if (w_param) { |
| + // Navigation request. |
| const wchar_t* url = reinterpret_cast<const wchar_t*>(w_param); |
| request_url = GURL(url); |
| } else if (l_param) { |
| - const wchar_t* search_string = |
| - reinterpret_cast<const wchar_t*>(l_param); |
| + // Search request. |
| + const wchar_t* search_string; |
| + wchar_t atom[128] = {0}; |
|
ananta
2012/08/20 21:40:48
Instead of hardcoding the atom array size, perhaps
|
| + if (!base::win::IsMetroProcess()) { |
| + // Normally, we only receive this message from our own process if we are |
| + // in metro. If we are not, then it means that metro chrome is sending |
| + // us that message and the url is in an atom. |
| + UINT result = |
| + GlobalGetAtomName(static_cast<ATOM>(l_param), atom, arraysize(atom)); |
| + if (!result) |
| + return; |
| + search_string = atom; |
| + GlobalDeleteAtom(static_cast<ATOM>(l_param)); |
| + } else { |
| + search_string = reinterpret_cast<const wchar_t*>(l_param); |
| + } |
| + |
| const TemplateURL* default_provider = |
| TemplateURLServiceFactory::GetForProfile(browser->profile())-> |
| GetDefaultSearchProvider(); |