1 // Copyright 2019 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 WEBLAYER_PUBLIC_NEW_TAB_DELEGATE_H_
6 #define WEBLAYER_PUBLIC_NEW_TAB_DELEGATE_H_
7 
8 #include <memory>
9 
10 namespace weblayer {
11 
12 class Tab;
13 
14 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.weblayer_private
15 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: ImplNewTabType
16 // Corresponds to type of browser the page requested.
17 enum class NewTabType {
18   // The new browser should be opened in the foreground.
19   kForeground = 0,
20 
21   // The new browser should be opened in the foreground.
22   kBackground,
23 
24   // The page requested the browser be shown in a new window with minimal
25   // browser UI. For example, no tabstrip.
26   kNewPopup,
27 
28   // The page requested the browser be shown in a new window.
29   kNewWindow,
30 };
31 
32 // An interface that allows clients to handle requests for new browsers, or
33 // in web terms, a new popup/window (and random other things).
34 class NewTabDelegate {
35  public:
36   // Called when a new tab is created by the browser. |new_tab| is owned by the
37   // browser.
38   virtual void OnNewTab(Tab* new_tab, NewTabType type) = 0;
39 
40  protected:
~NewTabDelegate()41   virtual ~NewTabDelegate() {}
42 };
43 
44 }  // namespace weblayer
45 
46 #endif  // WEBLAYER_PUBLIC_NEW_TAB_DELEGATE_H_
47