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

Side by Side Diff: content/browser/tab_contents/tab_contents.cc

Issue 6871020: Added functionality to use "SaveAs..." from PDF plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/tab_contents/tab_contents.h" 5 #include "content/browser/tab_contents/tab_contents.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/metrics/stats_counters.h" 12 #include "base/metrics/stats_counters.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "chrome/app/chrome_command_ids.h"
17 #include "chrome/browser/blocked_content_container.h" 18 #include "chrome/browser/blocked_content_container.h"
18 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/browser_shutdown.h" 20 #include "chrome/browser/browser_shutdown.h"
20 #include "chrome/browser/character_encoding.h" 21 #include "chrome/browser/character_encoding.h"
21 #include "chrome/browser/content_settings/content_settings_details.h" 22 #include "chrome/browser/content_settings/content_settings_details.h"
22 #include "chrome/browser/content_settings/host_content_settings_map.h" 23 #include "chrome/browser/content_settings/host_content_settings_map.h"
23 #include "chrome/browser/debugger/devtools_manager.h" 24 #include "chrome/browser/debugger/devtools_manager.h"
24 #include "chrome/browser/defaults.h" 25 #include "chrome/browser/defaults.h"
25 #include "chrome/browser/dom_operation_notification_details.h" 26 #include "chrome/browser/dom_operation_notification_details.h"
26 #include "chrome/browser/download/download_item_model.h" 27 #include "chrome/browser/download/download_item_model.h"
(...skipping 18 matching lines...) Expand all
45 #include "chrome/browser/renderer_host/web_cache_manager.h" 46 #include "chrome/browser/renderer_host/web_cache_manager.h"
46 #include "chrome/browser/renderer_preferences_util.h" 47 #include "chrome/browser/renderer_preferences_util.h"
47 #include "chrome/browser/safe_browsing/client_side_detection_host.h" 48 #include "chrome/browser/safe_browsing/client_side_detection_host.h"
48 #include "chrome/browser/sessions/session_types.h" 49 #include "chrome/browser/sessions/session_types.h"
49 #include "chrome/browser/tab_contents/infobar_delegate.h" 50 #include "chrome/browser/tab_contents/infobar_delegate.h"
50 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" 51 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h"
51 #include "chrome/browser/tab_contents/thumbnail_generator.h" 52 #include "chrome/browser/tab_contents/thumbnail_generator.h"
52 #include "chrome/browser/translate/page_translated_details.h" 53 #include "chrome/browser/translate/page_translated_details.h"
53 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" 54 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h"
54 #include "chrome/browser/ui/browser_dialogs.h" 55 #include "chrome/browser/ui/browser_dialogs.h"
56 #include "chrome/browser/ui/download/download_tab_helper.h"
57 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
jam 2011/04/15 17:58:44 TabContents doesn't know about TabContentsWrapper,
55 #include "chrome/common/bindings_policy.h" 58 #include "chrome/common/bindings_policy.h"
56 #include "chrome/common/chrome_constants.h" 59 #include "chrome/common/chrome_constants.h"
57 #include "chrome/common/chrome_switches.h" 60 #include "chrome/common/chrome_switches.h"
58 #include "chrome/common/content_restriction.h" 61 #include "chrome/common/content_restriction.h"
59 #include "chrome/common/extensions/extension.h" 62 #include "chrome/common/extensions/extension.h"
60 #include "chrome/common/extensions/extension_messages.h" 63 #include "chrome/common/extensions/extension_messages.h"
61 #include "chrome/common/extensions/url_pattern.h" 64 #include "chrome/common/extensions/url_pattern.h"
62 #include "chrome/common/pref_names.h" 65 #include "chrome/common/pref_names.h"
63 #include "chrome/common/render_messages.h" 66 #include "chrome/common/render_messages.h"
64 #include "chrome/common/url_constants.h" 67 #include "chrome/common/url_constants.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 OnDidDisplayInsecureContent) 403 OnDidDisplayInsecureContent)
401 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent, 404 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent,
402 OnDidRunInsecureContent) 405 OnDidRunInsecureContent)
403 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame, 406 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame,
404 OnDocumentLoadedInFrame) 407 OnDocumentLoadedInFrame)
405 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnDidFinishLoad) 408 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnDidFinishLoad)
406 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateContentRestrictions, 409 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateContentRestrictions,
407 OnUpdateContentRestrictions) 410 OnUpdateContentRestrictions)
408 IPC_MESSAGE_HANDLER(ViewHostMsg_PDFHasUnsupportedFeature, 411 IPC_MESSAGE_HANDLER(ViewHostMsg_PDFHasUnsupportedFeature,
409 OnPDFHasUnsupportedFeature) 412 OnPDFHasUnsupportedFeature)
413 IPC_MESSAGE_HANDLER(ViewHostMsg_SaveAs, OnSaveAs)
410 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) 414 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset)
411 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents) 415 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents)
412 IPC_MESSAGE_HANDLER(ViewHostMsg_PageTranslated, OnPageTranslated) 416 IPC_MESSAGE_HANDLER(ViewHostMsg_PageTranslated, OnPageTranslated)
413 IPC_MESSAGE_UNHANDLED(handled = false) 417 IPC_MESSAGE_UNHANDLED(handled = false)
414 IPC_END_MESSAGE_MAP_EX() 418 IPC_END_MESSAGE_MAP_EX()
415 419
416 if (!message_is_ok) { 420 if (!message_is_ok) {
417 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); 421 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD"));
418 GetRenderProcessHost()->ReceivedBadMessage(); 422 GetRenderProcessHost()->ReceivedBadMessage();
419 } 423 }
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 } 1372 }
1369 1373
1370 void TabContents::OnUpdateContentRestrictions(int restrictions) { 1374 void TabContents::OnUpdateContentRestrictions(int restrictions) {
1371 SetContentRestrictions(restrictions); 1375 SetContentRestrictions(restrictions);
1372 } 1376 }
1373 1377
1374 void TabContents::OnPDFHasUnsupportedFeature() { 1378 void TabContents::OnPDFHasUnsupportedFeature() {
1375 PDFHasUnsupportedFeature(this); 1379 PDFHasUnsupportedFeature(this);
1376 } 1380 }
1377 1381
1382 void TabContents::OnSaveAs() {
1383 TabContentsWrapper* wrapper =
1384 TabContentsWrapper::GetCurrentWrapperForContents(this);
1385 wrapper->download_tab_helper()->OnSavePage();
1386 }
1387
1378 // Notifies the RenderWidgetHost instance about the fact that the page is 1388 // Notifies the RenderWidgetHost instance about the fact that the page is
1379 // loading, or done loading and calls the base implementation. 1389 // loading, or done loading and calls the base implementation.
1380 void TabContents::SetIsLoading(bool is_loading, 1390 void TabContents::SetIsLoading(bool is_loading,
1381 LoadNotificationDetails* details) { 1391 LoadNotificationDetails* details) {
1382 if (is_loading == is_loading_) 1392 if (is_loading == is_loading_)
1383 return; 1393 return;
1384 1394
1385 if (!is_loading) { 1395 if (!is_loading) {
1386 load_state_ = net::LOAD_STATE_IDLE; 1396 load_state_ = net::LOAD_STATE_IDLE;
1387 load_state_host_.clear(); 1397 load_state_host_.clear();
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after
2573 2583
2574 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2584 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2575 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); 2585 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
2576 rwh_view->SetSize(view()->GetContainerSize()); 2586 rwh_view->SetSize(view()->GetContainerSize());
2577 } 2587 }
2578 2588
2579 void TabContents::OnOnlineStateChanged(bool online) { 2589 void TabContents::OnOnlineStateChanged(bool online) {
2580 render_view_host()->Send(new ViewMsg_NetworkStateChanged( 2590 render_view_host()->Send(new ViewMsg_NetworkStateChanged(
2581 render_view_host()->routing_id(), online)); 2591 render_view_host()->routing_id(), online));
2582 } 2592 }
OLDNEW
« no previous file with comments | « content/browser/tab_contents/tab_contents.h ('k') | content/renderer/pepper_plugin_delegate_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698