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

Side by Side Diff: remoting/client/plugin/chromoting_instance.cc

Issue 12220092: Rename ClientDimensions to ClientResolution and add pixel-size and DPI fields. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typos in ChromotingInstance. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | remoting/host/chromoting_host.h » ('j') | remoting/host/client_session.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/client/plugin/chromoting_instance.h" 5 #include "remoting/client/plugin/chromoting_instance.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #undef PostMessage 47 #undef PostMessage
48 #endif 48 #endif
49 49
50 namespace remoting { 50 namespace remoting {
51 51
52 namespace { 52 namespace {
53 53
54 // 32-bit BGRA is 4 bytes per pixel. 54 // 32-bit BGRA is 4 bytes per pixel.
55 const int kBytesPerPixel = 4; 55 const int kBytesPerPixel = 4;
56 56
57 // Default DPI to assume for old clients that use notifyClientDimensions.
58 const int kDefaultDPI = 96;
59
60 // Interval at which to sample performance statistics.
57 const int kPerfStatsIntervalMs = 1000; 61 const int kPerfStatsIntervalMs = 1000;
58 62
59 // URL scheme used by Chrome apps and extensions. 63 // URL scheme used by Chrome apps and extensions.
60 const char kChromeExtensionUrlScheme[] = "chrome-extension"; 64 const char kChromeExtensionUrlScheme[] = "chrome-extension";
61 65
62 std::string ConnectionStateToString(protocol::ConnectionToHost::State state) { 66 std::string ConnectionStateToString(protocol::ConnectionToHost::State state) {
63 // Values returned by this function must match the 67 // Values returned by this function must match the
64 // remoting.ClientSession.State enum in JS code. 68 // remoting.ClientSession.State enum in JS code.
65 switch (state) { 69 switch (state) {
66 case protocol::ConnectionToHost::INITIALIZING: 70 case protocol::ConnectionToHost::INITIALIZING:
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 protocol::ClipboardEvent event; 590 protocol::ClipboardEvent event;
587 event.set_mime_type(mime_type); 591 event.set_mime_type(mime_type);
588 event.set_data(item); 592 event.set_data(item);
589 host_connection_->clipboard_stub()->InjectClipboardEvent(event); 593 host_connection_->clipboard_stub()->InjectClipboardEvent(event);
590 } 594 }
591 595
592 void ChromotingInstance::NotifyClientDimensions(int width, int height) { 596 void ChromotingInstance::NotifyClientDimensions(int width, int height) {
593 if (!IsConnected()) { 597 if (!IsConnected()) {
594 return; 598 return;
595 } 599 }
596 protocol::ClientDimensions client_dimensions; 600
597 client_dimensions.set_width(width); 601 protocol::ClientResolution client_resolution;
598 client_dimensions.set_height(height); 602 client_resolution.set_width(width);
599 host_connection_->host_stub()->NotifyClientDimensions(client_dimensions); 603 client_resolution.set_height(height);
604 client_resolution.set_x_dpi(kDefaultDPI);
605 client_resolution.set_y_dpi(kDefaultDPI);
606
607 // Include the legacy width & height for use by older hosts.
608 client_resolution.set_dips_width(width);
609 client_resolution.set_dips_height(height);
610
611 host_connection_->host_stub()->NotifyClientResolution(client_resolution);
600 } 612 }
601 613
602 void ChromotingInstance::PauseVideo(bool pause) { 614 void ChromotingInstance::PauseVideo(bool pause) {
603 if (!IsConnected()) { 615 if (!IsConnected()) {
604 return; 616 return;
605 } 617 }
606 protocol::VideoControl video_control; 618 protocol::VideoControl video_control;
607 video_control.set_enable(!pause); 619 video_control.set_enable(!pause);
608 host_connection_->host_stub()->ControlVideo(video_control); 620 host_connection_->host_stub()->ControlVideo(video_control);
609 } 621 }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 url_components.scheme.len); 798 url_components.scheme.len);
787 return url_scheme == kChromeExtensionUrlScheme; 799 return url_scheme == kChromeExtensionUrlScheme;
788 } 800 }
789 801
790 bool ChromotingInstance::IsConnected() { 802 bool ChromotingInstance::IsConnected() {
791 return host_connection_.get() && 803 return host_connection_.get() &&
792 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); 804 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED);
793 } 805 }
794 806
795 } // namespace remoting 807 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/host/chromoting_host.h » ('j') | remoting/host/client_session.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698