summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/apps/chrome_shell_window_delegate.h
blob: 21897d4b743a03f8123a35a1b1c11a2b49f6b09c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// 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.

#ifndef CHROME_BROWSER_UI_APPS_CHROME_SHELL_WINDOW_DELEGATE_H_
#define CHROME_BROWSER_UI_APPS_CHROME_SHELL_WINDOW_DELEGATE_H_

#include "apps/app_window.h"
#include "base/memory/scoped_ptr.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/rect.h"

namespace content {
class BrowserContext;
}

class ShellWindowLinkDelegate : public content::WebContentsDelegate {
 public:
  ShellWindowLinkDelegate();
  virtual ~ShellWindowLinkDelegate();

 private:
  virtual content::WebContents* OpenURLFromTab(
      content::WebContents* source,
      const content::OpenURLParams& params) OVERRIDE;

  DISALLOW_COPY_AND_ASSIGN(ShellWindowLinkDelegate);
};

// TODO(jamescook): Rename to ChromeAppWindowDelegate. http://crbug.com/344084
class ChromeShellWindowDelegate : public apps::AppWindow::Delegate {
 public:
  ChromeShellWindowDelegate();
  virtual ~ChromeShellWindowDelegate();

  static void DisableExternalOpenForTesting();

 private:
  // apps::AppWindow::Delegate:
  virtual void InitWebContents(content::WebContents* web_contents) OVERRIDE;
  virtual apps::NativeAppWindow* CreateNativeAppWindow(
      apps::AppWindow* window,
      const apps::AppWindow::CreateParams& params) OVERRIDE;
  virtual content::WebContents* OpenURLFromTab(
      content::BrowserContext* context,
      content::WebContents* source,
      const content::OpenURLParams& params) OVERRIDE;
  virtual void AddNewContents(content::BrowserContext* context,
                              content::WebContents* new_contents,
                              WindowOpenDisposition disposition,
                              const gfx::Rect& initial_pos,
                              bool user_gesture,
                              bool* was_blocked) OVERRIDE;
  virtual content::ColorChooser* ShowColorChooser(
      content::WebContents* web_contents,
      SkColor initial_color) OVERRIDE;
  virtual void RunFileChooser(
      content::WebContents* tab,
      const content::FileChooserParams& params) OVERRIDE;
  virtual void RequestMediaAccessPermission(
      content::WebContents* web_contents,
      const content::MediaStreamRequest& request,
      const content::MediaResponseCallback& callback,
      const extensions::Extension* extension) OVERRIDE;
  virtual int PreferredIconSize() OVERRIDE;
  virtual void SetWebContentsBlocked(content::WebContents* web_contents,
                                     bool blocked) OVERRIDE;
  virtual bool IsWebContentsVisible(
      content::WebContents* web_contents) OVERRIDE;

  // Implemented in platform specific code.
  static apps::NativeAppWindow* CreateNativeAppWindowImpl(
      apps::AppWindow* window,
      const apps::AppWindow::CreateParams& params);

  scoped_ptr<ShellWindowLinkDelegate> shell_window_link_delegate_;

  DISALLOW_COPY_AND_ASSIGN(ChromeShellWindowDelegate);
};

#endif  // CHROME_BROWSER_UI_APPS_CHROME_SHELL_WINDOW_DELEGATE_H_