#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/chrome_web_modal_dialog_manager_delegate.h"
#include "chrome/browser/ui/host_desktop.h"
+#include "chrome/browser/ui/search/search_tab_helper_delegate.h"
#include "chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h"
#include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/browser/ui/zoom/zoom_observer.h"
#include "chrome/common/content_settings.h"
#include "chrome/common/content_settings_types.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/page_navigator.h"
public content::WebContentsDelegate,
public CoreTabHelperDelegate,
public SearchEngineTabHelperDelegate,
+ public SearchTabHelperDelegate,
public ChromeWebModalDialogManagerDelegate,
public BookmarkTabHelperDelegate,
public ZoomObserver,
TYPE_POPUP = 2
};
- // Distinguishes between browsers that host an app (opened from
- // ApplicationLauncher::OpenApplication), and child browsers created by an app
- // from Browser::CreateForApp (e.g. by windows.open or the extension API).
- enum AppType {
- APP_TYPE_HOST = 1,
- APP_TYPE_CHILD = 2
- };
-
// Possible elements of the Browser window.
enum WindowFeature {
FEATURE_NONE = 0,
Profile* profile,
chrome::HostDesktopType host_desktop_type);
- static CreateParams CreateForApp(Type type,
- const std::string& app_name,
+ static CreateParams CreateForApp(const std::string& app_name,
+ bool trusted_source,
const gfx::Rect& window_bounds,
Profile* profile,
chrome::HostDesktopType host_desktop_type);
// The host desktop the browser is created on.
chrome::HostDesktopType host_desktop_type;
- // The application name that is also the name of the window to the shell.
- // This name should be set when:
- // 1) we launch an application via an application shortcut or extension API.
- // 2) we launch an undocked devtool window.
- std::string app_name;
-
- // Type of app (host or child). See description of AppType.
- AppType app_type;
+ // Specifies the browser is_trusted_source_ value.
+ bool trusted_source;
// The bounds of the window to open.
gfx::Rect initial_bounds;
// Supply a custom BrowserWindow implementation, to be used instead of the
// default. Intended for testing.
BrowserWindow* window;
+
+ private:
+ friend class Browser;
+
+ // The application name that is also the name of the window to the shell.
+ // Do not set this value directly, use CreateForApp.
+ // This name will be set for:
+ // 1) v1 applications launched via an application shortcut or extension API.
+ // 2) undocked devtool windows.
+ // 3) popup windows spawned from v1 applications.
+ std::string app_name;
};
// Constructors, Creation, Showing //////////////////////////////////////////
Type type() const { return type_; }
const std::string& app_name() const { return app_name_; }
- AppType app_type() const { return app_type_; }
+ bool is_trusted_source() const { return is_trusted_source_; }
Profile* profile() const { return profile_; }
gfx::Rect override_bounds() const { return override_bounds_; }
// Invoked when visible SSL state (as defined by SSLStatus) changes.
void VisibleSSLStateChanged(content::WebContents* web_contents);
- // Invoked when the |web_contents| no longer supports Instant. Refreshes the
- // omnibox so it no longer shows search terms.
- void OnWebContentsInstantSupportDisabled(
- const content::WebContents* web_contents);
-
// Assorted browser commands ////////////////////////////////////////////////
// NOTE: Within each of the following sections, the IDs are ordered roughly by
// See the description of
// FullscreenController::ToggleFullscreenModeWithExtension.
void ToggleFullscreenModeWithExtension(const GURL& extension_url);
+
#if defined(OS_WIN)
// See the description of FullscreenController::ToggleMetroSnapMode.
void SetMetroSnapMode(bool enable);
// Overridden from content::WebContentsDelegate:
virtual bool CanOverscrollContent() const OVERRIDE;
+ virtual bool ShouldPreserveAbortedURLs(content::WebContents* source) OVERRIDE;
virtual bool PreHandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event,
FRIEND_TEST_ALL_PREFIXES(BrowserTest, ConvertTabToAppShortcut);
FRIEND_TEST_ALL_PREFIXES(BrowserTest, OpenAppWindowLikeNtp);
FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch);
+ FRIEND_TEST_ALL_PREFIXES(BrowserTest, ShouldShowLocationBar);
FRIEND_TEST_ALL_PREFIXES(FullscreenControllerTest,
TabEntersPresentationModeFromWindowed);
FRIEND_TEST_ALL_PREFIXES(FullscreenExitBubbleControllerTest,
const base::FilePath& plugin_path,
const base::Callback<void(bool)>& callback) OVERRIDE;
virtual gfx::Size GetSizeForNewRenderView(
- const content::WebContents* web_contents) const OVERRIDE;
+ content::WebContents* web_contents) const OVERRIDE;
// Overridden from CoreTabHelperDelegate:
// Note that the caller is responsible for deleting |old_contents|.
virtual void ConfirmAddSearchProvider(TemplateURL* template_url,
Profile* profile) OVERRIDE;
+ // Overridden from SearchTabHelperDelegate:
+ virtual void NavigateOnThumbnailClick(
+ const GURL& url,
+ WindowOpenDisposition disposition,
+ content::WebContents* source_contents) OVERRIDE;
+ virtual void OnWebContentsInstantSupportDisabled(
+ const content::WebContents* web_contents) OVERRIDE;
+ virtual OmniboxView* GetOmniboxView() OVERRIDE;
+ virtual std::set<std::string> GetOpenUrls() OVERRIDE;
+
// Overridden from WebContentsModalDialogManagerDelegate:
virtual void SetWebContentsBlocked(content::WebContents* web_contents,
bool blocked) OVERRIDE;
// 2) we launch an undocked devtool window.
std::string app_name_;
- // Type of app (host or child). See description of AppType.
- AppType app_type_;
+ // True if the source is trusted (i.e. we do not need to show the URL in a
+ // a popup window). Also used to determine which app windows to save and
+ // restore on Chrome OS.
+ bool is_trusted_source_;
// Unique identifier of this browser for session restore. This id is only
// unique within the current session, and is not guaranteed to be unique