summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/app_window/app_window_api.h
blob: 06694e231e10d971cb214f48d02d79f048cd32ca (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
// Copyright (c) 2012 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_API_APP_WINDOW_APP_WINDOW_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_APP_WINDOW_APP_WINDOW_API_H_

#include "apps/app_window.h"
#include "extensions/browser/extension_function.h"

namespace extensions {

namespace api {
namespace app_window {
struct CreateWindowOptions;
}
}

class AppWindowCreateFunction : public AsyncExtensionFunction {
 public:
  AppWindowCreateFunction();
  DECLARE_EXTENSION_FUNCTION("app.window.create", APP_WINDOW_CREATE)

 protected:
  virtual ~AppWindowCreateFunction() {}
  virtual bool RunAsync() OVERRIDE;

 private:
  bool GetBoundsSpec(
      const extensions::api::app_window::CreateWindowOptions& options,
      apps::AppWindow::CreateParams* params,
      std::string* error);

  apps::AppWindow::Frame GetFrameFromString(const std::string& frame_string);
  bool GetFrameOptions(
      const extensions::api::app_window::CreateWindowOptions& options,
      apps::AppWindow::CreateParams* create_params);
  void UpdateFrameOptionsForChannel(
      apps::AppWindow::CreateParams* create_params);

  bool inject_html_titlebar_;
};

}  // namespace extensions

#endif  // CHROME_BROWSER_EXTENSIONS_API_APP_WINDOW_APP_WINDOW_API_H_