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 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1492 // Clear focus state for OSK. | 1492 // Clear focus state for OSK. |
1493 FormTextFieldFocusChange(false); | 1493 FormTextFieldFocusChange(false); |
1494 | 1494 |
1495 // Update progress control. | 1495 // Update progress control. |
1496 if (progress_bar_.visible()) | 1496 if (progress_bar_.visible()) |
1497 progress_bar_.Fade(false, kProgressFadeTimeoutMs); | 1497 progress_bar_.Fade(false, kProgressFadeTimeoutMs); |
1498 | 1498 |
1499 DCHECK(document_load_state_ == LOAD_STATE_LOADING); | 1499 DCHECK(document_load_state_ == LOAD_STATE_LOADING); |
1500 document_load_state_ = LOAD_STATE_COMPLETE; | 1500 document_load_state_ = LOAD_STATE_COMPLETE; |
1501 UserMetricsRecordAction("PDF.LoadSuccess"); | 1501 UserMetricsRecordAction("PDF.LoadSuccess"); |
1502 | |
1503 if (did_call_start_loading_) { | |
ivandavid
2014/08/15 00:35:23
I know you said to create a different CL for all t
Vitaly Buka (NO REVIEWS)
2014/08/15 00:58:36
Seems reasonable.
On 2014/08/15 00:35:23, ivandav
Lei Zhang
2014/08/15 02:12:55
This looks correct. Before this change, there's 2
| |
1504 pp::PDF::DidStopLoading(this); | |
1505 did_call_start_loading_ = false; | |
1506 } | |
1507 | |
1502 if (on_load_callback_.is_string()) | 1508 if (on_load_callback_.is_string()) |
1503 ExecuteScript(on_load_callback_); | 1509 ExecuteScript(on_load_callback_); |
1504 // Note: If we are in print preview mode on_load_callback_ might call | 1510 // Note: If we are in print preview mode on_load_callback_ might call |
1505 // ScrollTo{X|Y}() and we don't want to scroll again and override it. | 1511 // ScrollTo{X|Y}() and we don't want to scroll again and override it. |
1506 // #page=N is not supported in Print Preview. | 1512 // #page=N is not supported in Print Preview. |
1507 if (!IsPrintPreview()) { | 1513 if (!IsPrintPreview()) { |
1508 int initial_page = GetInitialPage(url_); | 1514 int initial_page = GetInitialPage(url_); |
1509 if (initial_page >= 0) | 1515 if (initial_page >= 0) |
1510 ScrollToPage(initial_page); | 1516 ScrollToPage(initial_page); |
1511 } | 1517 } |
1512 | 1518 |
1513 if (!full_) | 1519 if (!full_) |
1514 return; | 1520 return; |
1515 if (!pp::PDF::IsAvailable()) | 1521 if (!pp::PDF::IsAvailable()) |
1516 return; | 1522 return; |
1517 | 1523 |
1518 if (did_call_start_loading_) { | |
1519 pp::PDF::DidStopLoading(this); | |
1520 did_call_start_loading_ = false; | |
1521 } | |
1522 | |
1523 int content_restrictions = | 1524 int content_restrictions = |
1524 CONTENT_RESTRICTION_CUT | CONTENT_RESTRICTION_PASTE; | 1525 CONTENT_RESTRICTION_CUT | CONTENT_RESTRICTION_PASTE; |
1525 if (!engine_->HasPermission(PDFEngine::PERMISSION_COPY)) | 1526 if (!engine_->HasPermission(PDFEngine::PERMISSION_COPY)) |
1526 content_restrictions |= CONTENT_RESTRICTION_COPY; | 1527 content_restrictions |= CONTENT_RESTRICTION_COPY; |
1527 | 1528 |
1528 if (!engine_->HasPermission(PDFEngine::PERMISSION_PRINT_LOW_QUALITY) && | 1529 if (!engine_->HasPermission(PDFEngine::PERMISSION_PRINT_LOW_QUALITY) && |
1529 !engine_->HasPermission(PDFEngine::PERMISSION_PRINT_HIGH_QUALITY)) { | 1530 !engine_->HasPermission(PDFEngine::PERMISSION_PRINT_HIGH_QUALITY)) { |
1530 printing_enabled_ = false; | 1531 printing_enabled_ = false; |
1531 if (current_tb_info_ == kPDFToolbarButtons) { | 1532 if (current_tb_info_ == kPDFToolbarButtons) { |
1532 // Remove Print button. | 1533 // Remove Print button. |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2721 return instance_->HasScriptableMethod(name, exception); | 2722 return instance_->HasScriptableMethod(name, exception); |
2722 } | 2723 } |
2723 | 2724 |
2724 pp::Var PDFScriptableObject::Call(const pp::Var& method, | 2725 pp::Var PDFScriptableObject::Call(const pp::Var& method, |
2725 const std::vector<pp::Var>& args, | 2726 const std::vector<pp::Var>& args, |
2726 pp::Var* exception) { | 2727 pp::Var* exception) { |
2727 return instance_->CallScriptableMethod(method, args, exception); | 2728 return instance_->CallScriptableMethod(method, args, exception); |
2728 } | 2729 } |
2729 | 2730 |
2730 } // namespace chrome_pdf | 2731 } // namespace chrome_pdf |
OLD | NEW |