Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 if (event.GetModifiers() & kDefaultKeyModifier) { |
| 594 case 'A': | 593 switch (keyboard_event.GetKeyCode()) { |
| 595 engine_->SelectAll(); | 594 case 'A': |
| 596 return true; | 595 engine_->SelectAll(); |
| 597 case ui::VKEY_OEM_4: | 596 return true; |
| 598 // Left bracket. | 597 } |
| 599 engine_->RotateCounterclockwise(); | 598 } |
| 600 return true; | 599 else if (event.GetModifiers() & PP_INPUTEVENT_MODIFIER_CONTROLKEY) { |
|
raymes
2014/09/26 02:49:26
nit: shift onto the previous line
Lei Zhang
2014/09/26 04:31:41
Done.
| |
| 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 Loading... | |
| 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 |
| OLD | NEW |