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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/startup/startup_browser_creator_win.h"
7 #include "base/logging.h"
8 #include "base/win/metro.h"
9 #include "chrome/browser/search_engines/util.h"
10 #include "chrome/browser/ui/browser_finder.h"
11 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
13 #include "chrome/common/url_constants.h"
14 #include "win8/util/win8_util.h"
18 GURL
GetURLToOpen(Profile
* profile
) {
19 base::string16 params
;
20 base::win::MetroLaunchType launch_type
=
21 base::win::GetMetroLaunchParams(¶ms
);
22 if ((launch_type
== base::win::METRO_PROTOCOL
) ||
23 (launch_type
== base::win::METRO_LAUNCH
))
25 return (launch_type
== base::win::METRO_SEARCH
) ?
26 GetDefaultSearchURLForSearchTerms(profile
, params
) : GURL();
32 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser(
34 const std::vector
<GURL
>& startup_urls
) {
35 if (!win8::IsSingleWindowMetroMode())
38 // We activate an existing browser window if we are opening just the new tab
39 // page in metro mode.
40 if (startup_urls
.size() > 1)
43 if (startup_urls
[0] != GURL(chrome::kChromeUINewTabURL
))
46 Browser
* browser
= chrome::FindBrowserWithProfile(
47 profile
, chrome::HOST_DESKTOP_TYPE_NATIVE
);
52 browser
->window()->Show();