Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome_frame/chrome_frame_npapi.h" | 5 #include "chrome_frame/chrome_frame_npapi.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/common/url_constants.h" | |
| 14 #include "chrome/test/automation/tab_proxy.h" | 15 #include "chrome/test/automation/tab_proxy.h" |
| 15 #include "chrome_frame/ff_privilege_check.h" | 16 #include "chrome_frame/ff_privilege_check.h" |
| 16 #include "chrome_frame/np_utils.h" | 17 #include "chrome_frame/np_utils.h" |
| 17 #include "chrome_frame/scoped_ns_ptr_win.h" | 18 #include "chrome_frame/scoped_ns_ptr_win.h" |
| 18 #include "chrome_frame/utils.h" | 19 #include "chrome_frame/utils.h" |
| 19 | 20 |
| 20 MessageLoop* ChromeFrameNPAPI::message_loop_ = NULL; | 21 MessageLoop* ChromeFrameNPAPI::message_loop_ = NULL; |
| 21 int ChromeFrameNPAPI::instance_count_ = 0; | 22 int ChromeFrameNPAPI::instance_count_ = 0; |
| 22 | 23 |
| 23 static const char* kNpEventNames[] = { | 24 static const char* kNpEventNames[] = { |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 411 print_bounds.left = window.x; | 412 print_bounds.left = window.x; |
| 412 print_bounds.top = window.y; | 413 print_bounds.top = window.y; |
| 413 print_bounds.right = window.x + window.width; | 414 print_bounds.right = window.x + window.width; |
| 414 print_bounds.bottom = window.x + window.height; | 415 print_bounds.bottom = window.x + window.height; |
| 415 | 416 |
| 416 automation_client_->Print( | 417 automation_client_->Print( |
| 417 reinterpret_cast<HDC>(print_info->print.embedPrint.platformPrint), | 418 reinterpret_cast<HDC>(print_info->print.embedPrint.platformPrint), |
| 418 print_bounds); | 419 print_bounds); |
| 419 } | 420 } |
| 420 | 421 |
| 422 bool ChromeFrameNPAPI::IsSchemeAllowed(const GURL& url) { | |
|
amit
2010/12/14 19:37:58
This looks identical to the ActiveX version. So ma
| |
| 423 bool allowed = NavigationConstraintsImpl::IsSchemeAllowed(url); | |
| 424 if (allowed) | |
| 425 return true; | |
| 426 | |
| 427 if (is_privileged_ && | |
| 428 (url.SchemeIs(chrome::kDataScheme) || | |
| 429 url.SchemeIs(chrome::kExtensionScheme))) { | |
| 430 return true; | |
| 431 } | |
| 432 return false; | |
| 433 } | |
| 434 | |
| 421 void ChromeFrameNPAPI::UrlNotify(const char* url, NPReason reason, | 435 void ChromeFrameNPAPI::UrlNotify(const char* url, NPReason reason, |
| 422 void* notify_data) { | 436 void* notify_data) { |
| 423 if (enabled_popups_) { | 437 if (enabled_popups_) { |
| 424 // We have opened the URL so tell the browser to restore popup settings | 438 // We have opened the URL so tell the browser to restore popup settings |
| 425 enabled_popups_ = false; | 439 enabled_popups_ = false; |
| 426 npapi::PopPopupsEnabledState(instance_); | 440 npapi::PopPopupsEnabledState(instance_); |
| 427 } | 441 } |
| 428 | 442 |
| 429 url_fetcher_.UrlNotify(url, reason, notify_data); | 443 url_fetcher_.UrlNotify(url, reason, notify_data); |
| 430 } | 444 } |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1505 } | 1519 } |
| 1506 | 1520 |
| 1507 int32 ChromeFrameNPAPI::Write(NPStream* stream, int32 offset, int32 len, | 1521 int32 ChromeFrameNPAPI::Write(NPStream* stream, int32 offset, int32 len, |
| 1508 void* buffer) { | 1522 void* buffer) { |
| 1509 return url_fetcher_.Write(stream, offset, len, buffer); | 1523 return url_fetcher_.Write(stream, offset, len, buffer); |
| 1510 } | 1524 } |
| 1511 | 1525 |
| 1512 NPError ChromeFrameNPAPI::DestroyStream(NPStream* stream, NPReason reason) { | 1526 NPError ChromeFrameNPAPI::DestroyStream(NPStream* stream, NPReason reason) { |
| 1513 return url_fetcher_.DestroyStream(stream, reason); | 1527 return url_fetcher_.DestroyStream(stream, reason); |
| 1514 } | 1528 } |
| OLD | NEW |