OLD | NEW |
| (Empty) |
1 // Copyright 2015 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 BLIMP_CLIENT_CORE_CONTENTS_TAB_CONTROL_FEATURE_H_ | |
6 #define BLIMP_CLIENT_CORE_CONTENTS_TAB_CONTROL_FEATURE_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | |
11 #include "blimp/net/blimp_message_processor.h" | |
12 #include "ui/gfx/geometry/size.h" | |
13 | |
14 namespace gfx { | |
15 class Size; | |
16 } | |
17 | |
18 namespace blimp { | |
19 namespace client { | |
20 | |
21 class TabControlFeature : public BlimpMessageProcessor { | |
22 public: | |
23 TabControlFeature(); | |
24 ~TabControlFeature() override; | |
25 | |
26 // Set the BlimpMessageProcessor that will be used to send | |
27 // BlimpMessage::TAB_CONTROL messages to the engine. | |
28 void set_outgoing_message_processor( | |
29 std::unique_ptr<BlimpMessageProcessor> processor); | |
30 | |
31 // Pushes the current size and scale information to the engine, which will | |
32 // affect the web content display area for all tabs. | |
33 virtual void SetSizeAndScale(const gfx::Size& size, float device_pixel_ratio); | |
34 | |
35 virtual void CreateTab(int tab_id); | |
36 virtual void CloseTab(int tab_id); | |
37 | |
38 // BlimpMessageProcessor implementation. | |
39 void ProcessMessage(std::unique_ptr<BlimpMessage> message, | |
40 const net::CompletionCallback& callback) override; | |
41 | |
42 private: | |
43 // Used to send BlimpMessage::TAB_CONTROL messages to the engine. | |
44 std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_; | |
45 | |
46 // Used to avoid sending unnecessary messages to engine. | |
47 gfx::Size last_size_; | |
48 float last_device_pixel_ratio_ = -1; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(TabControlFeature); | |
51 }; | |
52 | |
53 } // namespace client | |
54 } // namespace blimp | |
55 | |
56 #endif // BLIMP_CLIENT_CORE_CONTENTS_TAB_CONTROL_FEATURE_H_ | |
OLD | NEW |