James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 1 | // Copyright 2016 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 ASH_NEW_WINDOW_CONTROLLER_H_ |
| 6 | #define ASH_NEW_WINDOW_CONTROLLER_H_ |
| 7 | |
Evan Stade | cae9d30 | 2017-10-03 18:52:31 | [diff] [blame] | 8 | #include "ash/ash_export.h" |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 9 | #include "ash/public/interfaces/new_window.mojom.h" |
| 10 | #include "base/macros.h" |
| 11 | #include "mojo/public/cpp/bindings/associated_binding.h" |
James Cook | 3918d7bb62 | 2017-12-14 01:23:05 | [diff] [blame] | 12 | #include "mojo/public/cpp/bindings/binding_set.h" |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 13 | |
| 14 | namespace ash { |
| 15 | |
| 16 | // Provides the NewWindowController interface to the outside world. This lets a |
| 17 | // consumer of ash provide a NewWindowClient, which we will dispatch to if one |
| 18 | // has been provided to us. |
Evan Stade | cae9d30 | 2017-10-03 18:52:31 | [diff] [blame] | 19 | class ASH_EXPORT NewWindowController : public mojom::NewWindowController { |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 20 | public: |
| 21 | NewWindowController(); |
| 22 | ~NewWindowController() override; |
| 23 | |
| 24 | void BindRequest(mojom::NewWindowControllerRequest request); |
| 25 | |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 26 | // NewWindowController: |
| 27 | void SetClient(mojom::NewWindowClientAssociatedPtrInfo client) override; |
Evan Stade | cae9d30 | 2017-10-03 18:52:31 | [diff] [blame] | 28 | void ShowKeyboardOverlay() override; |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 29 | |
Evan Stade | cae9d30 | 2017-10-03 18:52:31 | [diff] [blame] | 30 | // Pass throughs for methods of the same name on |client_|. |
| 31 | void NewTab(); |
| 32 | void NewWindow(bool incognito); |
| 33 | void OpenFileManager(); |
| 34 | void OpenCrosh(); |
| 35 | void OpenGetHelp(); |
| 36 | void RestoreTab(); |
| 37 | void ShowTaskManager(); |
| 38 | void OpenFeedbackPage(); |
| 39 | |
| 40 | private: |
James Cook | 3918d7bb62 | 2017-12-14 01:23:05 | [diff] [blame] | 41 | // More than one part of chrome may connect to call the mojo methods, so use |
| 42 | // BindingSet instead of Binding. http://crbug.com/794581 |
| 43 | mojo::BindingSet<mojom::NewWindowController> bindings_; |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 44 | |
| 45 | mojom::NewWindowClientAssociatedPtr client_; |
| 46 | |
| 47 | DISALLOW_COPY_AND_ASSIGN(NewWindowController); |
| 48 | }; |
| 49 | |
| 50 | } // namespace ash |
| 51 | |
| 52 | #endif // ASH_NEW_WINDOW_CONTROLLER_H_ |