summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/extensions/web_auth_flow_window.h
blob: a69d1b51ebfe6d9452b4749cc8b7573a2c5bb39f (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
// 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_UI_EXTENSIONS_WEB_AUTH_FLOW_WINDOW_H_
#define CHROME_BROWSER_UI_EXTENSIONS_WEB_AUTH_FLOW_WINDOW_H_
#pragma once

#include "base/basictypes.h"

class Profile;

namespace content {
class BrowserContext;
class WebContents;
}

// Platform independent abstraction for a window that performs web auth flow.
// Platform specific implementations implement this abstract class.
class WebAuthFlowWindow {
 public:
  class Delegate {
   public:
    virtual void OnClose() = 0;
  };

  // TODO(munjal): Allow customizing these?
  static const int kDefaultWidth = 1024;
  static const int kDefaultHeight = 768;

  // Creates a new instance of WebAuthFlowWindow with the given parmaters.
  // Delegate::OnClose will be called when the window is closed.
  static WebAuthFlowWindow* Create(Delegate* delegate,
                                   content::BrowserContext* browser_context,
                                   content::WebContents* contents);

  virtual ~WebAuthFlowWindow();

  // Show the window.
  virtual void Show() = 0;

 protected:
  WebAuthFlowWindow(Delegate* delegate,
                    content::BrowserContext* browser_context,
                    content::WebContents* contents);

  Delegate* delegate() { return delegate_; }
  content::BrowserContext* browser_context() { return browser_context_; }
  content::WebContents* contents() { return contents_; }

 private:
  Delegate* delegate_;
  content::BrowserContext* browser_context_;
  content::WebContents* contents_;

  DISALLOW_COPY_AND_ASSIGN(WebAuthFlowWindow);
};

#endif  // CHROME_BROWSER_UI_EXTENSIONS_WEB_AUTH_FLOW_WINDOW_H_