Home | History | Annotate | Download | only in apps
      1 // Copyright 2014 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.
      4 
      5 #ifndef CHROME_BROWSER_UI_APPS_CHROME_APP_WINDOW_DELEGATE_H_
      6 #define CHROME_BROWSER_UI_APPS_CHROME_APP_WINDOW_DELEGATE_H_
      7 
      8 #include "apps/app_window.h"
      9 #include "base/memory/scoped_ptr.h"
     10 #include "ui/base/window_open_disposition.h"
     11 #include "ui/gfx/rect.h"
     12 
     13 namespace content {
     14 class BrowserContext;
     15 class WebContents;
     16 }
     17 
     18 class ChromeAppWindowDelegate : public apps::AppWindow::Delegate {
     19  public:
     20   ChromeAppWindowDelegate();
     21   virtual ~ChromeAppWindowDelegate();
     22 
     23   static void DisableExternalOpenForTesting();
     24 
     25  private:
     26   class NewWindowContentsDelegate;
     27 
     28   // apps::AppWindow::Delegate:
     29   virtual void InitWebContents(content::WebContents* web_contents) OVERRIDE;
     30   virtual apps::NativeAppWindow* CreateNativeAppWindow(
     31       apps::AppWindow* window,
     32       const apps::AppWindow::CreateParams& params) OVERRIDE;
     33   virtual content::WebContents* OpenURLFromTab(
     34       content::BrowserContext* context,
     35       content::WebContents* source,
     36       const content::OpenURLParams& params) OVERRIDE;
     37   virtual void AddNewContents(content::BrowserContext* context,
     38                               content::WebContents* new_contents,
     39                               WindowOpenDisposition disposition,
     40                               const gfx::Rect& initial_pos,
     41                               bool user_gesture,
     42                               bool* was_blocked) OVERRIDE;
     43   virtual content::ColorChooser* ShowColorChooser(
     44       content::WebContents* web_contents,
     45       SkColor initial_color) OVERRIDE;
     46   virtual void RunFileChooser(
     47       content::WebContents* tab,
     48       const content::FileChooserParams& params) OVERRIDE;
     49   virtual void RequestMediaAccessPermission(
     50       content::WebContents* web_contents,
     51       const content::MediaStreamRequest& request,
     52       const content::MediaResponseCallback& callback,
     53       const extensions::Extension* extension) OVERRIDE;
     54   virtual int PreferredIconSize() OVERRIDE;
     55   virtual void SetWebContentsBlocked(content::WebContents* web_contents,
     56                                      bool blocked) OVERRIDE;
     57   virtual bool IsWebContentsVisible(
     58       content::WebContents* web_contents) OVERRIDE;
     59 
     60   // Implemented in platform specific code.
     61   static apps::NativeAppWindow* CreateNativeAppWindowImpl(
     62       apps::AppWindow* window,
     63       const apps::AppWindow::CreateParams& params);
     64 
     65   scoped_ptr<NewWindowContentsDelegate> new_window_contents_delegate_;
     66 
     67   DISALLOW_COPY_AND_ASSIGN(ChromeAppWindowDelegate);
     68 };
     69 
     70 #endif  // CHROME_BROWSER_UI_APPS_CHROME_APP_WINDOW_DELEGATE_H_
     71