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

Side by Side Diff: pdf/instance.cc

Issue 581913003: PDF Viewer - Add keyboard shortcuts for rotation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback (nit fix) Created 6 years, 3 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
« no previous file with comments | « chrome/browser/resources/pdf/pdf.js ('k') | pdf/out_of_process_instance.cc » ('j') | no next file with comments »
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 "pdf/instance.h" 5 #include "pdf/instance.h"
6 6
7 #include <algorithm> // for min() 7 #include <algorithm> // for min()
8 #define _USE_MATH_DEFINES // for M_PI 8 #define _USE_MATH_DEFINES // for M_PI
9 #include <cmath> // for log() and pow() 9 #include <cmath> // for log() and pow()
10 #include <math.h> 10 #include <math.h>
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 } 587 }
588 } 588 }
589 589
590 if (event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN && 590 if (event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN &&
591 event.GetModifiers() & kDefaultKeyModifier) { 591 event.GetModifiers() & kDefaultKeyModifier) {
592 pp::KeyboardInputEvent keyboard_event(event); 592 pp::KeyboardInputEvent keyboard_event(event);
593 switch (keyboard_event.GetKeyCode()) { 593 switch (keyboard_event.GetKeyCode()) {
594 case 'A': 594 case 'A':
595 engine_->SelectAll(); 595 engine_->SelectAll();
596 return true; 596 return true;
597 case ui::VKEY_OEM_4:
598 // Left bracket.
599 engine_->RotateCounterclockwise();
600 return true;
601 case ui::VKEY_OEM_6:
602 // Right bracket.
603 engine_->RotateClockwise();
604 return true;
597 } 605 }
598 } 606 }
599 607
600 // Return true for unhandled clicks so the plugin takes focus. 608 // Return true for unhandled clicks so the plugin takes focus.
601 return (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEDOWN); 609 return (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEDOWN);
602 } 610 }
603 611
604 void Instance::DidChangeView(const pp::View& view) { 612 void Instance::DidChangeView(const pp::View& view) {
605 pp::Rect view_rect(view.GetRect()); 613 pp::Rect view_rect(view.GetRect());
606 float device_scale = 1.0f; 614 float device_scale = 1.0f;
(...skipping 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after
2743 return instance_->HasScriptableMethod(name, exception); 2751 return instance_->HasScriptableMethod(name, exception);
2744 } 2752 }
2745 2753
2746 pp::Var PDFScriptableObject::Call(const pp::Var& method, 2754 pp::Var PDFScriptableObject::Call(const pp::Var& method,
2747 const std::vector<pp::Var>& args, 2755 const std::vector<pp::Var>& args,
2748 pp::Var* exception) { 2756 pp::Var* exception) {
2749 return instance_->CallScriptableMethod(method, args, exception); 2757 return instance_->CallScriptableMethod(method, args, exception);
2750 } 2758 }
2751 2759
2752 } // namespace chrome_pdf 2760 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « chrome/browser/resources/pdf/pdf.js ('k') | pdf/out_of_process_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698