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

Side by Side Diff: pdf/instance.cc

Issue 606933002: PDF: Change the rotate shortcut keys to ctrl+[] on all platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 6 years, 2 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') | no next file » | 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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 if (set_timer) { 580 if (set_timer) {
581 last_mouse_event_ = pp::MouseInputEvent(event); 581 last_mouse_event_ = pp::MouseInputEvent(event);
582 582
583 pp::CompletionCallback callback = 583 pp::CompletionCallback callback =
584 timer_factory_.NewCallback(&Instance::OnTimerFired); 584 timer_factory_.NewCallback(&Instance::OnTimerFired);
585 pp::Module::Get()->core()->CallOnMainThread(kDragTimerMs, callback); 585 pp::Module::Get()->core()->CallOnMainThread(kDragTimerMs, callback);
586 timer_pending_ = true; 586 timer_pending_ = true;
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) {
592 pp::KeyboardInputEvent keyboard_event(event); 591 pp::KeyboardInputEvent keyboard_event(event);
593 switch (keyboard_event.GetKeyCode()) { 592 const uint32 modifier = event.GetModifiers();
594 case 'A': 593 if (modifier & kDefaultKeyModifier) {
595 engine_->SelectAll(); 594 switch (keyboard_event.GetKeyCode()) {
596 return true; 595 case 'A':
597 case ui::VKEY_OEM_4: 596 engine_->SelectAll();
598 // Left bracket. 597 return true;
599 engine_->RotateCounterclockwise(); 598 }
600 return true; 599 } else if (modifier & PP_INPUTEVENT_MODIFIER_CONTROLKEY) {
601 case ui::VKEY_OEM_6: 600 switch (keyboard_event.GetKeyCode()) {
602 // Right bracket. 601 case ui::VKEY_OEM_4:
603 engine_->RotateClockwise(); 602 // Left bracket.
604 return true; 603 engine_->RotateCounterclockwise();
604 return true;
605 case ui::VKEY_OEM_6:
606 // Right bracket.
607 engine_->RotateClockwise();
608 return true;
609 }
605 } 610 }
606 } 611 }
607 612
608 // Return true for unhandled clicks so the plugin takes focus. 613 // Return true for unhandled clicks so the plugin takes focus.
609 return (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEDOWN); 614 return (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEDOWN);
610 } 615 }
611 616
612 void Instance::DidChangeView(const pp::View& view) { 617 void Instance::DidChangeView(const pp::View& view) {
613 pp::Rect view_rect(view.GetRect()); 618 pp::Rect view_rect(view.GetRect());
614 float device_scale = 1.0f; 619 float device_scale = 1.0f;
(...skipping 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after
2751 return instance_->HasScriptableMethod(name, exception); 2756 return instance_->HasScriptableMethod(name, exception);
2752 } 2757 }
2753 2758
2754 pp::Var PDFScriptableObject::Call(const pp::Var& method, 2759 pp::Var PDFScriptableObject::Call(const pp::Var& method,
2755 const std::vector<pp::Var>& args, 2760 const std::vector<pp::Var>& args,
2756 pp::Var* exception) { 2761 pp::Var* exception) {
2757 return instance_->CallScriptableMethod(method, args, exception); 2762 return instance_->CallScriptableMethod(method, args, exception);
2758 } 2763 }
2759 2764
2760 } // namespace chrome_pdf 2765 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « chrome/browser/resources/pdf/pdf.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698