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

Side by Side Diff: chrome_frame/chrome_frame_automation.cc

Issue 274071: When Chrome hands off a URL to be opened by the external host by the ViewHost... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome_frame/chrome_frame_automation.h ('k') | chrome_frame/chrome_frame_delegate.h » ('j') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_automation.h" 5 #include "chrome_frame/chrome_frame_automation.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/file_version_info.h" 10 #include "base/file_version_info.h"
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 // We must destroy the window, since if there are pending tasks 476 // We must destroy the window, since if there are pending tasks
477 // window procedure may be invoked after DLL is unloaded. 477 // window procedure may be invoked after DLL is unloaded.
478 // Unfortunately pending tasks are leaked. 478 // Unfortunately pending tasks are leaked.
479 if (m_hWnd) 479 if (m_hWnd)
480 DestroyWindow(); 480 DestroyWindow();
481 481
482 chrome_frame_delegate_ = NULL; 482 chrome_frame_delegate_ = NULL;
483 init_state_ = UNINITIALIZED; 483 init_state_ = UNINITIALIZED;
484 } 484 }
485 485
486 bool ChromeFrameAutomationClient::InitiateNavigation(const std::string& url, 486 bool ChromeFrameAutomationClient::InitiateNavigation(
487 bool is_privileged) { 487 const std::string& url, const std::string& referrer, bool is_privileged) {
488 if (url.empty()) 488 if (url.empty())
489 return false; 489 return false;
490 490
491 url_ = GURL(url); 491 url_ = GURL(url);
492 492
493 // Catch invalid URLs early. 493 // Catch invalid URLs early.
494 if (!url_.is_valid() || !IsValidUrlScheme(UTF8ToWide(url), is_privileged)) { 494 if (!url_.is_valid() || !IsValidUrlScheme(UTF8ToWide(url), is_privileged)) {
495 DLOG(ERROR) << "Invalid URL passed to InitiateNavigation: " << url 495 DLOG(ERROR) << "Invalid URL passed to InitiateNavigation: " << url
496 << " is_privileged=" << is_privileged; 496 << " is_privileged=" << is_privileged;
497 return false; 497 return false;
498 } 498 }
499 499
500 if (is_initialized()) { 500 if (is_initialized()) {
501 BeginNavigate(GURL(url)); 501 BeginNavigate(GURL(url), GURL(referrer));
502 } 502 }
503 503
504 return true; 504 return true;
505 } 505 }
506 506
507 bool ChromeFrameAutomationClient::NavigateToIndex(int index) { 507 bool ChromeFrameAutomationClient::NavigateToIndex(int index) {
508 // Could be NULL if we failed to launch Chrome in LaunchAutomationServer() 508 // Could be NULL if we failed to launch Chrome in LaunchAutomationServer()
509 if (!automation_server_ || !tab_.get() || !tab_->is_valid()) { 509 if (!automation_server_ || !tab_.get() || !tab_->is_valid()) {
510 return false; 510 return false;
511 } 511 }
(...skipping 19 matching lines...) Expand all
531 } 531 }
532 532
533 bool ChromeFrameAutomationClient::SetProxySettings( 533 bool ChromeFrameAutomationClient::SetProxySettings(
534 const std::string& json_encoded_proxy_settings) { 534 const std::string& json_encoded_proxy_settings) {
535 if (!is_initialized()) 535 if (!is_initialized())
536 return false; 536 return false;
537 automation_server_->SendProxyConfig(json_encoded_proxy_settings); 537 automation_server_->SendProxyConfig(json_encoded_proxy_settings);
538 return true; 538 return true;
539 } 539 }
540 540
541 void ChromeFrameAutomationClient::BeginNavigate(const GURL& url) { 541 void ChromeFrameAutomationClient::BeginNavigate(const GURL& url,
542 const GURL& referrer) {
542 // Could be NULL if we failed to launch Chrome in LaunchAutomationServer() 543 // Could be NULL if we failed to launch Chrome in LaunchAutomationServer()
543 if (!automation_server_ || !tab_.get()) { 544 if (!automation_server_ || !tab_.get()) {
544 DLOG(WARNING) << "BeginNavigate - can't navigate."; 545 DLOG(WARNING) << "BeginNavigate - can't navigate.";
545 ReportNavigationError(AUTOMATION_MSG_NAVIGATION_ERROR, url_.spec()); 546 ReportNavigationError(AUTOMATION_MSG_NAVIGATION_ERROR, url_.spec());
546 return; 547 return;
547 } 548 }
548 549
549 DCHECK(::IsWindow(chrome_window_)); 550 DCHECK(::IsWindow(chrome_window_));
550 551
551 if (!tab_->is_valid()) { 552 if (!tab_->is_valid()) {
552 DLOG(WARNING) << "BeginNavigate - tab isn't valid."; 553 DLOG(WARNING) << "BeginNavigate - tab isn't valid.";
553 return; 554 return;
554 } 555 }
555 556
556 IPC::SyncMessage* msg = 557 IPC::SyncMessage* msg =
557 new AutomationMsg_NavigateInExternalTab(0, tab_->handle(), url, NULL); 558 new AutomationMsg_NavigateInExternalTab(0, tab_->handle(), url,
559 referrer, NULL);
558 automation_server_->SendAsAsync(msg, NewCallback(this, 560 automation_server_->SendAsAsync(msg, NewCallback(this,
559 &ChromeFrameAutomationClient::BeginNavigateCompleted), this); 561 &ChromeFrameAutomationClient::BeginNavigateCompleted), this);
560 562
561 RECT client_rect = {0}; 563 RECT client_rect = {0};
562 chrome_frame_delegate_->GetBounds(&client_rect); 564 chrome_frame_delegate_->GetBounds(&client_rect);
563 Resize(client_rect.right - client_rect.left, 565 Resize(client_rect.right - client_rect.left,
564 client_rect.bottom - client_rect.top, 566 client_rect.bottom - client_rect.top,
565 SWP_NOACTIVATE | SWP_NOZORDER); 567 SWP_NOACTIVATE | SWP_NOZORDER);
566 } 568 }
567 569
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 if (font_size < SMALLEST_FONT || 991 if (font_size < SMALLEST_FONT ||
990 font_size > LARGEST_FONT) { 992 font_size > LARGEST_FONT) {
991 NOTREACHED() << "Invalid font size specified : " 993 NOTREACHED() << "Invalid font size specified : "
992 << font_size; 994 << font_size;
993 return; 995 return;
994 } 996 }
995 997
996 Send(new AutomationMsg_SetPageFontSize(0, tab_handle_, font_size)); 998 Send(new AutomationMsg_SetPageFontSize(0, tab_handle_, font_size));
997 } 999 }
998 1000
OLDNEW
« no previous file with comments | « chrome_frame/chrome_frame_automation.h ('k') | chrome_frame/chrome_frame_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698