Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: chrome/browser/ui/views/frame/browser_frame_win.cc

Issue 10824387: Implement forwarding of search queries for metro mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/views/frame/browser_frame_win.h" 5 #include "chrome/browser/ui/views/frame/browser_frame_win.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <set> 9 #include <set>
10 10
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 if (CommandLine::ForCurrentProcess()->HasSwitch( 482 if (CommandLine::ForCurrentProcess()->HasSwitch(
483 switches::kDebugEnableFrameToggle)) { 483 switches::kDebugEnableFrameToggle)) {
484 system_menu_contents_->AddSeparator(); 484 system_menu_contents_->AddSeparator();
485 system_menu_contents_->AddItem(IDC_DEBUG_FRAME_TOGGLE, 485 system_menu_contents_->AddItem(IDC_DEBUG_FRAME_TOGGLE,
486 L"Toggle Frame Type"); 486 L"Toggle Frame Type");
487 } 487 }
488 } 488 }
489 489
490 void BrowserFrameWin::HandleMetroNavSearchRequest(WPARAM w_param, 490 void BrowserFrameWin::HandleMetroNavSearchRequest(WPARAM w_param,
491 LPARAM l_param) { 491 LPARAM l_param) {
492 if (!base::win::IsMetroProcess()) {
493 NOTREACHED() << "Received unexpected metro navigation request";
494 return;
495 }
496
497 if (!w_param && !l_param) { 492 if (!w_param && !l_param) {
498 NOTREACHED() << "Invalid metro request parameters"; 493 NOTREACHED() << "Invalid metro request parameters";
499 return; 494 return;
500 } 495 }
501 496
502 Browser* browser = browser_view()->browser(); 497 Browser* browser = browser_view()->browser();
503 DCHECK(browser); 498 DCHECK(browser);
504 499
505 GURL request_url; 500 GURL request_url;
506 501
507 if (w_param) { 502 if (w_param) {
503 // Navigation request.
508 const wchar_t* url = reinterpret_cast<const wchar_t*>(w_param); 504 const wchar_t* url = reinterpret_cast<const wchar_t*>(w_param);
509 request_url = GURL(url); 505 request_url = GURL(url);
510 } else if (l_param) { 506 } else if (l_param) {
511 const wchar_t* search_string = 507 // Search request.
512 reinterpret_cast<const wchar_t*>(l_param); 508 const wchar_t* search_string;
509 wchar_t atom[128] = {0};
ananta 2012/08/20 21:40:48 Instead of hardcoding the atom array size, perhaps
510 if (!base::win::IsMetroProcess()) {
511 // Normally, we only receive this message from our own process if we are
512 // in metro. If we are not, then it means that metro chrome is sending
513 // us that message and the url is in an atom.
514 UINT result =
515 GlobalGetAtomName(static_cast<ATOM>(l_param), atom, arraysize(atom));
516 if (!result)
517 return;
518 search_string = atom;
519 GlobalDeleteAtom(static_cast<ATOM>(l_param));
520 } else {
521 search_string = reinterpret_cast<const wchar_t*>(l_param);
522 }
523
513 const TemplateURL* default_provider = 524 const TemplateURL* default_provider =
514 TemplateURLServiceFactory::GetForProfile(browser->profile())-> 525 TemplateURLServiceFactory::GetForProfile(browser->profile())->
515 GetDefaultSearchProvider(); 526 GetDefaultSearchProvider();
516 if (default_provider) { 527 if (default_provider) {
517 const TemplateURLRef& search_url = default_provider->url_ref(); 528 const TemplateURLRef& search_url = default_provider->url_ref();
518 DCHECK(search_url.SupportsReplacement()); 529 DCHECK(search_url.SupportsReplacement());
519 request_url = GURL(search_url.ReplaceSearchTerms( 530 request_url = GURL(search_url.ReplaceSearchTerms(
520 TemplateURLRef::SearchTermsArgs(search_string))); 531 TemplateURLRef::SearchTermsArgs(search_string)));
521 } 532 }
522 } 533 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 596
586 //////////////////////////////////////////////////////////////////////////////// 597 ////////////////////////////////////////////////////////////////////////////////
587 // NativeBrowserFrame, public: 598 // NativeBrowserFrame, public:
588 599
589 // static 600 // static
590 NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame( 601 NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame(
591 BrowserFrame* browser_frame, 602 BrowserFrame* browser_frame,
592 BrowserView* browser_view) { 603 BrowserView* browser_view) {
593 return new BrowserFrameWin(browser_frame, browser_view); 604 return new BrowserFrameWin(browser_frame, browser_view);
594 } 605 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698