Chromium Code Reviews| 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 "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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 #include "content/browser/tab_contents/interstitial_page_impl.h" | 31 #include "content/browser/tab_contents/interstitial_page_impl.h" |
| 32 #include "content/browser/tab_contents/navigation_entry_impl.h" | 32 #include "content/browser/tab_contents/navigation_entry_impl.h" |
| 33 #include "content/browser/tab_contents/provisional_load_details.h" | 33 #include "content/browser/tab_contents/provisional_load_details.h" |
| 34 #include "content/browser/tab_contents/title_updated_details.h" | 34 #include "content/browser/tab_contents/title_updated_details.h" |
| 35 #include "content/browser/webui/web_ui_impl.h" | 35 #include "content/browser/webui/web_ui_impl.h" |
| 36 #include "content/common/intents_messages.h" | 36 #include "content/common/intents_messages.h" |
| 37 #include "content/common/ssl_status_serialization.h" | 37 #include "content/common/ssl_status_serialization.h" |
| 38 #include "content/common/view_messages.h" | 38 #include "content/common/view_messages.h" |
| 39 #include "content/port/browser/render_widget_host_view_port.h" | 39 #include "content/port/browser/render_widget_host_view_port.h" |
| 40 #include "content/public/browser/browser_context.h" | 40 #include "content/public/browser/browser_context.h" |
| 41 #include "content/public/browser/color_chooser.h" | |
| 41 #include "content/public/browser/content_browser_client.h" | 42 #include "content/public/browser/content_browser_client.h" |
| 42 #include "content/public/browser/devtools_agent_host_registry.h" | 43 #include "content/public/browser/devtools_agent_host_registry.h" |
| 43 #include "content/public/browser/download_manager.h" | 44 #include "content/public/browser/download_manager.h" |
| 44 #include "content/public/browser/invalidate_type.h" | 45 #include "content/public/browser/invalidate_type.h" |
| 45 #include "content/public/browser/javascript_dialogs.h" | 46 #include "content/public/browser/javascript_dialogs.h" |
| 46 #include "content/public/browser/navigation_details.h" | 47 #include "content/public/browser/navigation_details.h" |
| 47 #include "content/public/browser/notification_service.h" | 48 #include "content/public/browser/notification_service.h" |
| 48 #include "content/public/browser/user_metrics.h" | 49 #include "content/public/browser/user_metrics.h" |
| 49 #include "content/public/browser/web_contents_delegate.h" | 50 #include "content/public/browser/web_contents_delegate.h" |
| 50 #include "content/public/browser/web_contents_observer.h" | 51 #include "content/public/browser/web_contents_observer.h" |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 509 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) | 510 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) |
| 510 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) | 511 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) |
| 511 IPC_MESSAGE_HANDLER(ViewHostMsg_SaveURLAs, OnSaveURL) | 512 IPC_MESSAGE_HANDLER(ViewHostMsg_SaveURLAs, OnSaveURL) |
| 512 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) | 513 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) |
| 513 IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) | 514 IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) |
| 514 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, | 515 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, |
| 515 OnRegisterProtocolHandler) | 516 OnRegisterProtocolHandler) |
| 516 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) | 517 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) |
| 517 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) | 518 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) |
| 518 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) | 519 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) |
| 520 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser) | |
| 521 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser) | |
| 522 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser, | |
| 523 OnSetSelectedColorInColorChooser) | |
| 519 IPC_MESSAGE_UNHANDLED(handled = false) | 524 IPC_MESSAGE_UNHANDLED(handled = false) |
| 520 IPC_END_MESSAGE_MAP_EX() | 525 IPC_END_MESSAGE_MAP_EX() |
| 521 | 526 |
| 522 if (!message_is_ok) { | 527 if (!message_is_ok) { |
| 523 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); | 528 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); |
| 524 GetRenderProcessHost()->ReceivedBadMessage(); | 529 GetRenderProcessHost()->ReceivedBadMessage(); |
| 525 } | 530 } |
| 526 | 531 |
| 527 return handled; | 532 return handled; |
| 528 } | 533 } |
| 529 | 534 |
| 535 void TabContents::OnOpenColorChooser(int color_chooser_id, | |
| 536 const SkColor& color) { | |
| 537 color_chooser_ = delegate_->OpenColorChooser(this, color_chooser_id, color); | |
| 538 } | |
| 539 | |
| 540 void TabContents::OnEndColorChooser(int color_chooser_id) { | |
| 541 if (color_chooser_ && | |
| 542 GetRenderViewHost() == color_chooser_->GetRenderViewHost() && | |
|
jam
2012/02/27 22:06:25
why is this check necessary, i.e. shouldn't the id
keishi
2012/02/28 11:27:45
You're right. Removed.
| |
| 543 color_chooser_id == color_chooser_->GetIdentifier()) | |
| 544 color_chooser_->End(); | |
| 545 } | |
| 546 | |
| 547 void TabContents::OnSetSelectedColorInColorChooser( | |
| 548 int color_chooser_id, const SkColor& color) { | |
| 549 if (color_chooser_ && | |
| 550 GetRenderViewHost() == color_chooser_->GetRenderViewHost() && | |
| 551 color_chooser_id == color_chooser_->GetIdentifier()) | |
| 552 color_chooser_->SetSelectedColor(color); | |
| 553 } | |
| 554 | |
| 555 void TabContents::DidEndColorChooser() { | |
| 556 color_chooser_ = NULL; | |
| 557 delegate_->DidEndColorChooser(); | |
| 558 } | |
| 559 | |
| 530 void TabContents::RunFileChooser( | 560 void TabContents::RunFileChooser( |
| 531 RenderViewHost* render_view_host, | 561 RenderViewHost* render_view_host, |
| 532 const content::FileChooserParams& params) { | 562 const content::FileChooserParams& params) { |
| 533 delegate_->RunFileChooser(this, params); | 563 delegate_->RunFileChooser(this, params); |
| 534 } | 564 } |
| 535 | 565 |
| 536 NavigationController& TabContents::GetController() { | 566 NavigationController& TabContents::GetController() { |
| 537 return controller_; | 567 return controller_; |
| 538 } | 568 } |
| 539 | 569 |
| (...skipping 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2471 save_info, | 2501 save_info, |
| 2472 this); | 2502 this); |
| 2473 } | 2503 } |
| 2474 | 2504 |
| 2475 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2505 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 2476 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2506 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
| 2477 // Can be NULL during tests. | 2507 // Can be NULL during tests. |
| 2478 if (rwh_view) | 2508 if (rwh_view) |
| 2479 rwh_view->SetSize(GetView()->GetContainerSize()); | 2509 rwh_view->SetSize(GetView()->GetContainerSize()); |
| 2480 } | 2510 } |
| OLD | NEW |