13551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
43551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#ifndef CONTENT_SHELL_BROWSER_SHELL_H_
53551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#define CONTENT_SHELL_BROWSER_SHELL_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <vector>
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/basictypes.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/callback_forward.h"
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
13c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "base/strings/string_piece.h"
148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "build/build_config.h"
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/web_contents_delegate.h"
164e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "content/public/browser/web_contents_observer.h"
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ipc/ipc_channel.h"
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/gfx/native_widget_types.h"
192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ui/gfx/size.h"
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
21a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#if defined(OS_ANDROID)
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/android/scoped_java_ref.h"
232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#elif defined(USE_AURA)
242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#if defined(OS_CHROMEOS)
25116680a4aac90f2aa7413d9095a592090648e557Ben Murdochnamespace gfx {
26116680a4aac90f2aa7413d9095a592090648e557Ben Murdochclass Screen;
27116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch}
28f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)namespace wm {
29f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)class WMTestHelper;
30f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}
314e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#endif  // defined(OS_CHROMEOS)
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace views {
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Widget;
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ViewsDelegate;
35f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}
364e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#endif  // defined(USE_AURA)
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class GURL;
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace content {
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
418bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#if defined(USE_AURA)
425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class ShellPlatformDataAura;
438bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#endif
448bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BrowserContext;
462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class ShellDevToolsFrontend;
472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class ShellJavaScriptDialogManager;
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SiteInstance;
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class WebContents;
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This represents one window of the Content Shell, i.e. all the UI including
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// buttons and url bar, as well as the web content area.
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Shell : public WebContentsDelegate,
544e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)              public WebContentsObserver {
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
5690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  static const int kDefaultTestWindowWidthDip;
5790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  static const int kDefaultTestWindowHeightDip;
5890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~Shell();
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void LoadURL(const GURL& url);
622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void LoadURLForFrame(const GURL& url, const std::string& frame_name);
630529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  void LoadDataWithBaseURL(const GURL& url,
640529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch                           const std::string& data,
650529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch                           const GURL& base_url);
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void GoBackOrForward(int offset);
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void Reload();
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void Stop();
69effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  void UpdateNavigationControls(bool to_different_document);
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void Close();
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void ShowDevTools();
725d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void ShowDevToolsForElementAt(int x, int y);
730529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  void ShowDevToolsForTest(const std::string& settings,
740529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch                           const std::string& frontend_url);
752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void CloseDevTools();
76a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#if defined(OS_MACOSX)
77a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Resizes the web content view to the given dimensions.
78f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  void SizeTo(const gfx::Size& content_size);
792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif
805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Do one time initialization at application startup.
822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  static void Initialize();
835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static Shell* CreateNewWindow(BrowserContext* browser_context,
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                const GURL& url,
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                SiteInstance* site_instance,
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                int routing_id,
882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                const gfx::Size& initial_size);
895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the Shell object corresponding to the given RenderViewHost.
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static Shell* FromRenderViewHost(RenderViewHost* rvh);
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the currently open windows.
945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static std::vector<Shell*>& windows() { return windows_; }
955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Closes all windows and returns. This runs a message loop.
975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static void CloseAllWindows();
985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Used for content_browsertests. Called once.
1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static void SetShellCreatedCallback(
1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      base::Callback<void(Shell*)> shell_created_callback);
1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  WebContents* web_contents() const { return web_contents_.get(); }
1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  gfx::NativeWindow window() { return window_; }
1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(OS_MACOSX)
1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Public to be called by an ObjC bridge object.
1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void ActionPerformed(int control);
1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void URLEntered(std::string url_string);
1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#elif defined(OS_ANDROID)
1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Registers the Android Java to native methods.
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static bool Register(JNIEnv* env);
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // WebContentsDelegate
1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual WebContents* OpenURLFromTab(WebContents* source,
1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                      const OpenURLParams& params) OVERRIDE;
1184e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual void AddNewContents(WebContents* source,
1194e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)                              WebContents* new_contents,
1204e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)                              WindowOpenDisposition disposition,
1214e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)                              const gfx::Rect& initial_pos,
1224e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)                              bool user_gesture,
1234e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)                              bool* was_blocked) OVERRIDE;
124effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  virtual void LoadingStateChanged(WebContents* source,
125effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch                                   bool to_different_document) OVERRIDE;
1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(OS_ANDROID)
1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void LoadProgressChanged(WebContents* source,
1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                   double progress) OVERRIDE;
1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
1302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void ToggleFullscreenModeForTab(WebContents* web_contents,
1312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                          bool enter_fullscreen) OVERRIDE;
1322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual bool IsFullscreenForTabOrPending(
1332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      const WebContents* web_contents) const OVERRIDE;
1342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void RequestToLockMouse(WebContents* web_contents,
1352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                  bool user_gesture,
1362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                  bool last_unlocked_by_target) OVERRIDE;
1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void CloseContents(WebContents* source) OVERRIDE;
1382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual bool CanOverscrollContent() const OVERRIDE;
1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void DidNavigateMainFramePostCommit(
1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      WebContents* web_contents) OVERRIDE;
1412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual JavaScriptDialogManager* GetJavaScriptDialogManager() OVERRIDE;
1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(OS_MACOSX)
1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void HandleKeyboardEvent(
1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      WebContents* source,
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const NativeWebKeyboardEvent& event) OVERRIDE;
1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool AddMessageToConsole(WebContents* source,
1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                   int32 level,
149a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                                   const base::string16& message,
1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                   int32 line_no,
151a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                                   const base::string16& source_id) OVERRIDE;
1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void RendererUnresponsive(WebContents* source) OVERRIDE;
1532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void ActivateContents(WebContents* contents) OVERRIDE;
1542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void DeactivateContents(WebContents* contents) OVERRIDE;
155a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch  virtual void WorkerCrashed(WebContents* source) OVERRIDE;
1565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual bool HandleContextMenu(const content::ContextMenuParams& params)
1575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      OVERRIDE;
1585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void WebContentsFocused(WebContents* contents) OVERRIDE;
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  enum UIControl {
1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    BACK_BUTTON,
1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    FORWARD_BUTTON,
1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    STOP_BUTTON
1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
16790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  class DevToolsWebContentsObserver;
16890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  explicit Shell(WebContents* web_contents);
1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Helper to create a new Shell given a newly created WebContents.
172b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  static Shell* CreateShell(WebContents* web_contents,
173b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)                            const gfx::Size& initial_size);
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Helper for one time initialization of application
1762a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  static void PlatformInitialize(const gfx::Size& default_window_size);
177f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Helper for one time deinitialization of platform specific state.
178f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  static void PlatformExit();
1792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1804e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  // Adjust the size when Blink sends 0 for width and/or height.
1814e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  // This happens when Blink requests a default-sized window.
1824e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  static gfx::Size AdjustWindowSize(const gfx::Size& initial_size);
1834e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // All the methods that begin with Platform need to be implemented by the
1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // platform specific Shell implementation.
1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called from the destructor to let each platform do any necessary cleanup.
1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void PlatformCleanUp();
1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Creates the main window GUI.
1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void PlatformCreateWindow(int width, int height);
1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Links the WebContents into the newly created window.
1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void PlatformSetContents();
1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Resize the content area and GUI.
1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void PlatformResizeSubViews();
1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Enable/disable a button.
1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void PlatformEnableUIControl(UIControl control, bool is_enabled);
1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Updates the url in the url bar.
1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void PlatformSetAddressBarURL(const GURL& url);
1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sets whether the spinner is spinning.
1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void PlatformSetIsLoading(bool loading);
2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Set the title of shell window
201a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  void PlatformSetTitle(const base::string16& title);
2025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // User right-clicked on the web view
2035d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool PlatformHandleContextMenu(const content::ContextMenuParams& params);
2042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#if defined(OS_ANDROID)
2052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void PlatformToggleFullscreenModeForTab(WebContents* web_contents,
2062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                          bool enter_fullscreen);
2072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  bool PlatformIsFullscreenForTabOrPending(
2082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      const WebContents* web_contents) const;
2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
2105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#if defined(TOOLKIT_VIEWS)
2115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void PlatformWebContentsFocused(WebContents* contents);
2125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif
2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  gfx::NativeView GetContentView();
2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2164e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  // WebContentsObserver
2174e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual void TitleWasSet(NavigationEntry* entry, bool explicit_set) OVERRIDE;
2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2190529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  void InnerShowDevTools(const std::string& settings,
2200529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch                         const std::string& frontend_url);
22190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  void OnDevToolsWebContentsDestroyed();
22290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  scoped_ptr<ShellJavaScriptDialogManager> dialog_manager_;
2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<WebContents> web_contents_;
2265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
22790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  scoped_ptr<DevToolsWebContentsObserver> devtools_observer_;
2282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ShellDevToolsFrontend* devtools_frontend_;
2292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  bool is_fullscreen_;
2312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  gfx::NativeWindow window_;
2335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  gfx::NativeEditView url_edit_view_;
2345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
235f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  gfx::Size content_size_;
236f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
237a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#if defined(OS_ANDROID)
2385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  base::android::ScopedJavaGlobalRef<jobject> java_object_;
2395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#elif defined(USE_AURA)
2402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#if defined(OS_CHROMEOS)
241f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  static wm::WMTestHelper* wm_test_helper_;
242116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  static gfx::Screen* test_screen_;
2432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif
2448bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#if defined(TOOLKIT_VIEWS)
2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static views::ViewsDelegate* views_delegate_;
2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  views::Widget* window_widget_;
2488bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#endif // defined(TOOLKIT_VIEWS)
2495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  static ShellPlatformDataAura* platform_;
2505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif  // defined(USE_AURA)
2515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  bool headless_;
2532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // A container of all the open windows. We use a vector so we can keep track
2555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // of ordering.
2565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static std::vector<Shell*> windows_;
2575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static base::Callback<void(Shell*)> shell_created_callback_;
2595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // True if the destructur of Shell should post a quit closure on the current
2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // message loop if the destructed Shell object was the last one.
2625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static bool quit_message_loop_;
2635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
2645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace content
2665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2673551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#endif  // CONTENT_SHELL_BROWSER_SHELL_H_
268