This source file includes following definitions.
- GetURLToOpen
- OpenStartupURLsInExistingBrowser
#include "chrome/browser/ui/startup/startup_browser_creator_win.h"
#include "base/logging.h"
#include "base/win/metro.h"
#include "chrome/browser/search_engines/util.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
#include "chrome/common/url_constants.h"
#include "win8/util/win8_util.h"
namespace chrome {
GURL GetURLToOpen(Profile* profile) {
base::string16 params;
base::win::MetroLaunchType launch_type =
base::win::GetMetroLaunchParams(¶ms);
if ((launch_type == base::win::METRO_PROTOCOL) ||
(launch_type == base::win::METRO_LAUNCH))
return GURL(params);
return (launch_type == base::win::METRO_SEARCH) ?
GetDefaultSearchURLForSearchTerms(profile, params) : GURL();
}
}
bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser(
Profile* profile,
const std::vector<GURL>& startup_urls) {
if (!win8::IsSingleWindowMetroMode())
return false;
if (startup_urls.size() > 1)
return false;
if (startup_urls[0] != GURL(chrome::kChromeUINewTabURL))
return false;
Browser* browser = chrome::FindBrowserWithProfile(
profile, chrome::HOST_DESKTOP_TYPE_NATIVE);
if (!browser)
return false;
browser->window()->Show();
return true;
}