blob: a2439def8a20f64eaf4d8f73c87e2329391e41f6 [file] [log] [blame]
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "ash/public/interfaces/new_window.mojom.h"
#include "base/macros.h"
#include "components/arc/intent_helper/open_url_delegate.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
#include "url/gurl.h"
namespace content {
class WebContents;
// Handles opening new tabs and windows on behalf of ash (over mojo) and the
// ARC bridge (via a delegate in the browser process).
class ChromeNewWindowClient : public ash::mojom::NewWindowClient,
public arc::OpenUrlDelegate {
~ChromeNewWindowClient() override;
static ChromeNewWindowClient* Get();
// Overridden from ash::mojom::NewWindowClient:
void NewTab() override;
void NewTabWithUrl(const GURL& url, bool from_user_interaction) override;
void NewWindow(bool incognito) override;
void OpenFileManager() override;
void OpenCrosh() override;
void OpenGetHelp() override;
void RestoreTab() override;
void ShowKeyboardShortcutViewer() override;
void ShowTaskManager() override;
void OpenFeedbackPage(bool from_assistant) override;
// arc::OpenUrlDelegate:
void OpenUrlFromArc(const GURL& url) override;
void OpenWebAppFromArc(const GURL& url) override;
class TabRestoreHelper;
// Opens a URL in a new tab. Returns the WebContents for the tab that
// opened the URL. If the URL is for a chrome://settings page, opens settings
// in a new window and returns null. If the |from_user_interaction| is true
// then the page will load with a user activation. This means it will be able
// to autoplay media without restriction.
content::WebContents* OpenUrlImpl(const GURL& url,
bool from_user_interaction);
std::unique_ptr<TabRestoreHelper> tab_restore_helper_;
ash::mojom::NewWindowControllerPtr new_window_controller_;
// Binds this object to the client interface.
mojo::AssociatedBinding<ash::mojom::NewWindowClient> binding_;