summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_view.h
blob: e974d0973b5a875b7dca12bc6be2e78a238c1fbc (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
// Copyright 2014 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_EXTENSIONS_EXTENSION_VIEW_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_VIEW_H_

#include "ui/gfx/native_widget_types.h"

class Browser;

namespace content {
struct NativeWebKeyboardEvent;
class WebContents;
}

namespace gfx {
class Size;
}

namespace extensions {

// Base class for platform-specific views used by extensions in the Chrome UI.
class ExtensionView {
 public:
  virtual ~ExtensionView() {}

  // Initialize the view, once a newly created view has been set in the host.
  virtual void Init() = 0;

  // If attached to a Browser (e.g. popups), the Browser it is attached to.
  virtual Browser* GetBrowser() = 0;

  // Returns the extension's native view.
  virtual gfx::NativeView GetNativeView() = 0;

  // Method for the ExtensionHost to notify us about the correct size for
  // extension contents.
  virtual void ResizeDueToAutoResize(const gfx::Size& new_size) = 0;

  // Method for the ExtensionHost to notify us when the RenderViewHost has a
  // connection.
  virtual void RenderViewCreated() = 0;

  // Handles unhandled keyboard messages coming back from the renderer process.
  virtual void HandleKeyboardEvent(
      content::WebContents* source,
      const content::NativeWebKeyboardEvent& event) = 0;

  // Method for the ExtensionHost to notify that the extension page has loaded.
  virtual void DidStopLoading() = 0;
};

}  // namespace extensions

#endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_VIEW_H_