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

Side by Side Diff: chrome/browser/tab_contents/web_contents.cc

Issue 19632: Make WebContentsView portable by using the native view types. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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 | « base/build/base_gfx.vcproj ('k') | chrome/browser/tab_contents/web_contents_view.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/browser/tab_contents/web_contents.h" 5 #include "chrome/browser/tab_contents/web_contents.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_version_info.h" 9 #include "base/file_version_info.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 487
488 void WebContents::PopupNotificationVisibilityChanged(bool visible) { 488 void WebContents::PopupNotificationVisibilityChanged(bool visible) {
489 render_view_host()->PopupNotificationVisibilityChanged(visible); 489 render_view_host()->PopupNotificationVisibilityChanged(visible);
490 } 490 }
491 491
492 // Stupid view pass-throughs 492 // Stupid view pass-throughs
493 void WebContents::CreateView() { 493 void WebContents::CreateView() {
494 view_->CreateView(); 494 view_->CreateView();
495 } 495 }
496 HWND WebContents::GetContainerHWND() const { 496 HWND WebContents::GetContainerHWND() const {
497 return view_->GetContainerHWND(); 497 return view_->GetNativeView();
498 } 498 }
499 HWND WebContents::GetContentHWND() { 499 HWND WebContents::GetContentHWND() {
500 return view_->GetContentHWND(); 500 return view_->GetContentNativeView();
501 } 501 }
502 void WebContents::GetContainerBounds(gfx::Rect *out) const { 502 void WebContents::GetContainerBounds(gfx::Rect *out) const {
503 view_->GetContainerBounds(out); 503 view_->GetContainerBounds(out);
504 } 504 }
505 505
506 void WebContents::SetWebApp(WebApp* web_app) { 506 void WebContents::SetWebApp(WebApp* web_app) {
507 if (web_app_.get()) { 507 if (web_app_.get()) {
508 web_app_->RemoveObserver(this); 508 web_app_->RemoveObserver(this);
509 web_app_->SetWebContents(NULL); 509 web_app_->SetWebContents(NULL);
510 } 510 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 DCHECK(prefs); 566 DCHECK(prefs);
567 567
568 std::wstring suggest_name = 568 std::wstring suggest_name =
569 SavePackage::GetSuggestNameForSaveAs(prefs, GetTitle()); 569 SavePackage::GetSuggestNameForSaveAs(prefs, GetTitle());
570 570
571 SavePackage::SavePackageParam param(contents_mime_type()); 571 SavePackage::SavePackageParam param(contents_mime_type());
572 param.prefs = prefs; 572 param.prefs = prefs;
573 573
574 // TODO(rocking): Use new asynchronous dialog boxes to prevent the SaveAs 574 // TODO(rocking): Use new asynchronous dialog boxes to prevent the SaveAs
575 // dialog blocking the UI thread. See bug: http://b/issue?id=1129694. 575 // dialog blocking the UI thread. See bug: http://b/issue?id=1129694.
576 if (SavePackage::GetSaveInfo(suggest_name, GetContainerHWND(), &param, 576 if (SavePackage::GetSaveInfo(suggest_name, view_->GetNativeView(),
577 profile()->GetDownloadManager())) 577 &param, profile()->GetDownloadManager()))
578 SavePage(param.saved_main_file_path, param.dir, param.save_type); 578 SavePage(param.saved_main_file_path, param.dir, param.save_type);
579 } 579 }
580 580
581 void WebContents::SavePage(const std::wstring& main_file, 581 void WebContents::SavePage(const std::wstring& main_file,
582 const std::wstring& dir_path, 582 const std::wstring& dir_path,
583 SavePackage::SavePackageType save_type) { 583 SavePackage::SavePackageType save_type) {
584 // Stop the page from navigating. 584 // Stop the page from navigating.
585 Stop(); 585 Stop();
586 586
587 save_package_ = new SavePackage(this, save_type, main_file, dir_path); 587 save_package_ = new SavePackage(this, save_type, main_file, dir_path);
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 int current_index = controller()->GetLastCommittedEntryIndex(); 990 int current_index = controller()->GetLastCommittedEntryIndex();
991 *back_list_count = current_index; 991 *back_list_count = current_index;
992 *forward_list_count = controller()->GetEntryCount() - current_index - 1; 992 *forward_list_count = controller()->GetEntryCount() - current_index - 1;
993 } 993 }
994 } 994 }
995 995
996 void WebContents::RunFileChooser(bool multiple_files, 996 void WebContents::RunFileChooser(bool multiple_files,
997 const std::wstring& title, 997 const std::wstring& title,
998 const std::wstring& default_file, 998 const std::wstring& default_file,
999 const std::wstring& filter) { 999 const std::wstring& filter) {
1000 // TODO(brettw) move this to the view.
1000 HWND toplevel_hwnd = GetAncestor(GetContainerHWND(), GA_ROOT); 1001 HWND toplevel_hwnd = GetAncestor(GetContainerHWND(), GA_ROOT);
1001 if (!select_file_dialog_.get()) 1002 if (!select_file_dialog_.get())
1002 select_file_dialog_ = SelectFileDialog::Create(this); 1003 select_file_dialog_ = SelectFileDialog::Create(this);
1003 SelectFileDialog::Type dialog_type = 1004 SelectFileDialog::Type dialog_type =
1004 multiple_files ? SelectFileDialog::SELECT_OPEN_MULTI_FILE : 1005 multiple_files ? SelectFileDialog::SELECT_OPEN_MULTI_FILE :
1005 SelectFileDialog::SELECT_OPEN_FILE; 1006 SelectFileDialog::SELECT_OPEN_FILE;
1006 select_file_dialog_->SelectFile(dialog_type, title, default_file, filter, 1007 select_file_dialog_->SelectFile(dialog_type, title, default_file, filter,
1007 std::wstring(), toplevel_hwnd, NULL); 1008 std::wstring(), toplevel_hwnd, NULL);
1008 } 1009 }
1009 1010
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 // keyword has the same OSDD url and we've parsed it. 1138 // keyword has the same OSDD url and we've parsed it.
1138 return; 1139 return;
1139 } 1140 }
1140 1141
1141 // Download the OpenSearch description document. If this is successful a 1142 // Download the OpenSearch description document. If this is successful a
1142 // new keyword will be created when done. 1143 // new keyword will be created when done.
1143 profile()->GetTemplateURLFetcher()->ScheduleDownload( 1144 profile()->GetTemplateURLFetcher()->ScheduleDownload(
1144 keyword, 1145 keyword,
1145 url, 1146 url,
1146 base_entry->favicon().url(), 1147 base_entry->favicon().url(),
1147 GetAncestor(view_->GetContainerHWND(), GA_ROOT), 1148 GetAncestor(view_->GetNativeView(), GA_ROOT),
1148 autodetected); 1149 autodetected);
1149 } 1150 }
1150 1151
1151 void WebContents::InspectElementReply(int num_resources) { 1152 void WebContents::InspectElementReply(int num_resources) {
1152 // We have received reply from inspect element request. Notify the 1153 // We have received reply from inspect element request. Notify the
1153 // automation provider in case we need to notify automation client. 1154 // automation provider in case we need to notify automation client.
1154 NotificationService::current()-> 1155 NotificationService::current()->
1155 Notify(NOTIFY_DOM_INSPECT_ELEMENT_RESPONSE, Source<WebContents>(this), 1156 Notify(NOTIFY_DOM_INSPECT_ELEMENT_RESPONSE, Source<WebContents>(this),
1156 Details<int>(&num_resources)); 1157 Details<int>(&num_resources));
1157 } 1158 }
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
1787 // The favicon url isn't valid. This means there really isn't a favicon, 1788 // The favicon url isn't valid. This means there really isn't a favicon,
1788 // or the favicon url wasn't obtained before the load started. This assumes 1789 // or the favicon url wasn't obtained before the load started. This assumes
1789 // the later. 1790 // the later.
1790 // TODO(sky): Need a way to set the favicon that doesn't involve generating 1791 // TODO(sky): Need a way to set the favicon that doesn't involve generating
1791 // its url. 1792 // its url.
1792 new_url->SetFavIconURL(TemplateURL::GenerateFaviconURL(params.referrer)); 1793 new_url->SetFavIconURL(TemplateURL::GenerateFaviconURL(params.referrer));
1793 } 1794 }
1794 new_url->set_safe_for_autoreplace(true); 1795 new_url->set_safe_for_autoreplace(true);
1795 url_model->Add(new_url); 1796 url_model->Add(new_url);
1796 } 1797 }
OLDNEW
« no previous file with comments | « base/build/base_gfx.vcproj ('k') | chrome/browser/tab_contents/web_contents_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698