Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: blimp/client/session/tab_control_feature.cc

Issue 1636163002: Restructure contents of blimp/client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 #include "blimp/client/session/tab_control_feature.h"
6
7 #include "blimp/common/create_blimp_message.h"
8 #include "blimp/common/proto/blimp_message.pb.h"
9 #include "blimp/common/proto/tab_control.pb.h"
10 #include "blimp/net/blimp_message_processor.h"
11 #include "net/base/net_errors.h"
12
13 namespace blimp {
14 namespace client {
15
16 TabControlFeature::TabControlFeature() {}
17
18 TabControlFeature::~TabControlFeature() {}
19
20 void TabControlFeature::set_outgoing_message_processor(
21 scoped_ptr<BlimpMessageProcessor> processor) {
22 outgoing_message_processor_ = std::move(processor);
23 }
24
25 void TabControlFeature::SetSizeAndScale(const gfx::Size& size,
26 float device_pixel_ratio) {
27 if (last_size_ == size && last_device_pixel_ratio_ == device_pixel_ratio) {
28 return;
29 }
30
31 last_size_ = size;
32 last_device_pixel_ratio_ = device_pixel_ratio;
33
34 SizeMessage* size_details;
35 scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&size_details);
36 size_details->set_width(size.width());
37 size_details->set_height(size.height());
38 size_details->set_device_pixel_ratio(device_pixel_ratio);
39
40 // TODO(dtrainor): Don't keep sending size events to the server. Wait for a
41 // CompletionCallback to return before sending future size updates.
42 outgoing_message_processor_->ProcessMessage(std::move(message),
43 net::CompletionCallback());
44 }
45
46 void TabControlFeature::CreateTab(int tab_id) {
47 TabControlMessage* tab_control;
48 scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&tab_control);
49 tab_control->set_type(TabControlMessage::CREATE_TAB);
50 outgoing_message_processor_->ProcessMessage(std::move(message),
51 net::CompletionCallback());
52 }
53
54 void TabControlFeature::CloseTab(int tab_id) {
55 TabControlMessage* tab_control;
56 scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&tab_control);
57 tab_control->set_type(TabControlMessage::CLOSE_TAB);
58 outgoing_message_processor_->ProcessMessage(std::move(message),
59 net::CompletionCallback());
60 }
61
62 void TabControlFeature::ProcessMessage(
63 scoped_ptr<BlimpMessage> message,
64 const net::CompletionCallback& callback) {
65 DCHECK(!callback.is_null());
66 callback.Run(net::OK);
67
68 NOTIMPLEMENTED();
69 }
70
71 } // namespace client
72 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/client/session/tab_control_feature.h ('k') | blimp/client/session/tab_control_feature_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698