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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 namespace chrome_pdf { | 49 namespace chrome_pdf { |
50 | 50 |
51 struct ToolbarButtonInfo { | 51 struct ToolbarButtonInfo { |
52 uint32 id; | 52 uint32 id; |
53 Button::ButtonStyle style; | 53 Button::ButtonStyle style; |
54 PP_ResourceImage normal; | 54 PP_ResourceImage normal; |
55 PP_ResourceImage highlighted; | 55 PP_ResourceImage highlighted; |
56 PP_ResourceImage pressed; | 56 PP_ResourceImage pressed; |
57 }; | 57 }; |
58 | 58 |
| 59 const uint32 kBackgroundColor = 0xFFCCCCCC; |
| 60 |
59 namespace { | 61 namespace { |
60 | 62 |
61 // Uncomment following #define to enable thumbnails. | 63 // Uncomment following #define to enable thumbnails. |
62 // #define ENABLE_THUMBNAILS | 64 // #define ENABLE_THUMBNAILS |
63 | 65 |
64 const uint32 kToolbarSplashTimeoutMs = 6000; | 66 const uint32 kToolbarSplashTimeoutMs = 6000; |
65 const uint32 kMessageTextColor = 0xFF575757; | 67 const uint32 kMessageTextColor = 0xFF575757; |
66 const uint32 kMessageTextSize = 22; | 68 const uint32 kMessageTextSize = 22; |
67 const uint32 kProgressFadeTimeoutMs = 250; | 69 const uint32 kProgressFadeTimeoutMs = 250; |
68 const uint32 kProgressDelayTimeoutMs = 1000; | 70 const uint32 kProgressDelayTimeoutMs = 1000; |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 url = argv[i]; | 360 url = argv[i]; |
359 break; | 361 break; |
360 } | 362 } |
361 } | 363 } |
362 | 364 |
363 if (!url) | 365 if (!url) |
364 return false; | 366 return false; |
365 | 367 |
366 CreatePageIndicator(IsPrintPreviewUrl(url)); | 368 CreatePageIndicator(IsPrintPreviewUrl(url)); |
367 | 369 |
| 370 engine_->SetBackgroundColor(kBackgroundColor); |
| 371 |
368 if (!full_) { | 372 if (!full_) { |
369 // For PDFs embedded in a frame, we don't get the data automatically like we | 373 // For PDFs embedded in a frame, we don't get the data automatically like we |
370 // do for full-frame loads. Start loading the data manually. | 374 // do for full-frame loads. Start loading the data manually. |
371 LoadUrl(url); | 375 LoadUrl(url); |
372 } else { | 376 } else { |
373 DCHECK(!did_call_start_loading_); | 377 DCHECK(!did_call_start_loading_); |
374 pp::PDF::DidStartLoading(this); | 378 pp::PDF::DidStartLoading(this); |
375 did_call_start_loading_ = true; | 379 did_call_start_loading_ = true; |
376 } | 380 } |
377 | 381 |
(...skipping 2434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2812 return instance_->HasScriptableMethod(name, exception); | 2816 return instance_->HasScriptableMethod(name, exception); |
2813 } | 2817 } |
2814 | 2818 |
2815 pp::Var PDFScriptableObject::Call(const pp::Var& method, | 2819 pp::Var PDFScriptableObject::Call(const pp::Var& method, |
2816 const std::vector<pp::Var>& args, | 2820 const std::vector<pp::Var>& args, |
2817 pp::Var* exception) { | 2821 pp::Var* exception) { |
2818 return instance_->CallScriptableMethod(method, args, exception); | 2822 return instance_->CallScriptableMethod(method, args, exception); |
2819 } | 2823 } |
2820 | 2824 |
2821 } // namespace chrome_pdf | 2825 } // namespace chrome_pdf |
OLD | NEW |