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

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: 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
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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 } 583 }
584 } 584 }
585 585
586 if (event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN && 586 if (event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN &&
587 event.GetModifiers() & kDefaultKeyModifier) { 587 event.GetModifiers() & kDefaultKeyModifier) {
588 pp::KeyboardInputEvent keyboard_event(event); 588 pp::KeyboardInputEvent keyboard_event(event);
589 switch (keyboard_event.GetKeyCode()) { 589 switch (keyboard_event.GetKeyCode()) {
590 case 'A': 590 case 'A':
591 engine_->SelectAll(); 591 engine_->SelectAll();
592 return true; 592 return true;
593 case ui::VKEY_OEM_4:
594 // Left bracket.
595 engine_->RotateCounterclockwise();
596 return true;
597 case ui::VKEY_OEM_6:
598 // Right bracket.
599 engine_->RotateClockwise();
600 return true;
593 } 601 }
594 } 602 }
595 603
596 // Return true for unhandled clicks so the plugin takes focus. 604 // Return true for unhandled clicks so the plugin takes focus.
597 return (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEDOWN); 605 return (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEDOWN);
598 } 606 }
599 607
600 void Instance::DidChangeView(const pp::View& view) { 608 void Instance::DidChangeView(const pp::View& view) {
601 pp::Rect view_rect(view.GetRect()); 609 pp::Rect view_rect(view.GetRect());
602 float device_scale = 1.0f; 610 float device_scale = 1.0f;
(...skipping 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after
2739 return instance_->HasScriptableMethod(name, exception); 2747 return instance_->HasScriptableMethod(name, exception);
2740 } 2748 }
2741 2749
2742 pp::Var PDFScriptableObject::Call(const pp::Var& method, 2750 pp::Var PDFScriptableObject::Call(const pp::Var& method,
2743 const std::vector<pp::Var>& args, 2751 const std::vector<pp::Var>& args,
2744 pp::Var* exception) { 2752 pp::Var* exception) {
2745 return instance_->CallScriptableMethod(method, args, exception); 2753 return instance_->CallScriptableMethod(method, args, exception);
2746 } 2754 }
2747 2755
2748 } // namespace chrome_pdf 2756 } // namespace chrome_pdf
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698