Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / views / frame / web_contents_close_handler.h
blob9afa372da07f957d3052faf3b831e70ab7a04a2a
1 // Copyright 2014 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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_WEB_CONTENTS_CLOSE_HANDLER_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_WEB_CONTENTS_CLOSE_HANDLER_H_
8 #include "base/timer/timer.h"
10 class WebContentsCloseHandlerDelegate;
11 class WebContentsCloseHandlerTest;
13 // WebContentsCloseHandler handles notifying its delegate at the right time
14 // to clone and/or destroy the layer tree of the active tab. This is done so
15 // that on closing a window the user sees the contents of the last active
16 // tab rather than an empty rect.
17 class WebContentsCloseHandler {
18 public:
19 explicit WebContentsCloseHandler(WebContentsCloseHandlerDelegate* delegate);
20 ~WebContentsCloseHandler();
22 // Invoked when a tab is inserted.
23 void TabInserted();
25 // Invoked when the active WebContents changes.
26 void ActiveTabChanged();
28 // Invoked when all the tabs are about to be closed.
29 void WillCloseAllTabs();
31 // Invoked when the close was canceled.
32 void CloseAllTabsCanceled();
34 private:
35 friend class WebContentsCloseHandlerTest;
37 // Invoked from the |timer_|. If hit it means enough time has expired after a
38 // close was canceled.
39 void OnStillHaventClosed();
41 WebContentsCloseHandlerDelegate* delegate_;
43 // If true, WillCloseAllTabs() has been invoked.
44 bool in_close_;
46 // Set to true if the active tab changes while closing (ActiveTabChanged()
47 // was invoked following a WillCloseAllTabs()).
48 bool tab_changed_after_clone_;
50 base::OneShotTimer<WebContentsCloseHandler> timer_;
52 DISALLOW_COPY_AND_ASSIGN(WebContentsCloseHandler);
55 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_WEB_CONTENTS_CLOSE_HANDLER_H_