| OLD | NEW |
| 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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo, | 441 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo, |
| 442 OnDidGetApplicationInfo) | 442 OnDidGetApplicationInfo) |
| 443 IPC_MESSAGE_HANDLER(ViewHostMsg_InstallApplication, | 443 IPC_MESSAGE_HANDLER(ViewHostMsg_InstallApplication, |
| 444 OnInstallApplication) | 444 OnInstallApplication) |
| 445 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents) | 445 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents) |
| 446 IPC_MESSAGE_HANDLER(ViewHostMsg_PageTranslated, OnPageTranslated) | 446 IPC_MESSAGE_HANDLER(ViewHostMsg_PageTranslated, OnPageTranslated) |
| 447 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSuggestions, OnSetSuggestions) | 447 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSuggestions, OnSetSuggestions) |
| 448 IPC_MESSAGE_HANDLER(ViewHostMsg_InstantSupportDetermined, | 448 IPC_MESSAGE_HANDLER(ViewHostMsg_InstantSupportDetermined, |
| 449 OnInstantSupportDetermined) | 449 OnInstantSupportDetermined) |
| 450 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) | 450 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) |
| 451 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) |
| 451 IPC_MESSAGE_UNHANDLED(handled = false) | 452 IPC_MESSAGE_UNHANDLED(handled = false) |
| 452 IPC_END_MESSAGE_MAP_EX() | 453 IPC_END_MESSAGE_MAP_EX() |
| 453 | 454 |
| 454 if (!message_is_ok) { | 455 if (!message_is_ok) { |
| 455 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); | 456 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); |
| 456 GetRenderProcessHost()->ReceivedBadMessage(); | 457 GetRenderProcessHost()->ReceivedBadMessage(); |
| 457 } | 458 } |
| 458 | 459 |
| 459 return handled; | 460 return handled; |
| 460 } | 461 } |
| (...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1973 const std::vector<std::string>& suggestions) { | 1974 const std::vector<std::string>& suggestions) { |
| 1974 if (delegate()) | 1975 if (delegate()) |
| 1975 delegate()->OnSetSuggestions(page_id, suggestions); | 1976 delegate()->OnSetSuggestions(page_id, suggestions); |
| 1976 } | 1977 } |
| 1977 | 1978 |
| 1978 void TabContents::OnInstantSupportDetermined(int32 page_id, bool result) { | 1979 void TabContents::OnInstantSupportDetermined(int32 page_id, bool result) { |
| 1979 if (delegate()) | 1980 if (delegate()) |
| 1980 delegate()->OnInstantSupportDetermined(page_id, result); | 1981 delegate()->OnInstantSupportDetermined(page_id, result); |
| 1981 } | 1982 } |
| 1982 | 1983 |
| 1984 void TabContents::OnEnumerateDirectory(int request_id, const FilePath& path) { |
| 1985 if (file_select_helper_.get() == NULL) |
| 1986 file_select_helper_.reset(new FileSelectHelper(profile())); |
| 1987 file_select_helper_->EnumerateDirectory(request_id, render_view_host(), path); |
| 1988 } |
| 1989 |
| 1983 void TabContents::OnRunFileChooser( | 1990 void TabContents::OnRunFileChooser( |
| 1984 const ViewHostMsg_RunFileChooser_Params& params) { | 1991 const ViewHostMsg_RunFileChooser_Params& params) { |
| 1985 if (file_select_helper_.get() == NULL) | 1992 if (file_select_helper_.get() == NULL) |
| 1986 file_select_helper_.reset(new FileSelectHelper(profile())); | 1993 file_select_helper_.reset(new FileSelectHelper(profile())); |
| 1987 file_select_helper_->RunFileChooser(render_view_host(), params); | 1994 file_select_helper_->RunFileChooser(render_view_host(), params); |
| 1988 } | 1995 } |
| 1989 | 1996 |
| 1990 | |
| 1991 void TabContents::OnContentSettingsAccessed(bool content_was_blocked) { | 1997 void TabContents::OnContentSettingsAccessed(bool content_was_blocked) { |
| 1992 if (delegate_) | 1998 if (delegate_) |
| 1993 delegate_->OnContentSettingsChange(this); | 1999 delegate_->OnContentSettingsChange(this); |
| 1994 } | 2000 } |
| 1995 | 2001 |
| 1996 RenderViewHostDelegate::View* TabContents::GetViewDelegate() { | 2002 RenderViewHostDelegate::View* TabContents::GetViewDelegate() { |
| 1997 return view_.get(); | 2003 return view_.get(); |
| 1998 } | 2004 } |
| 1999 | 2005 |
| 2000 RenderViewHostDelegate::RendererManagement* | 2006 RenderViewHostDelegate::RendererManagement* |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2847 } | 2853 } |
| 2848 | 2854 |
| 2849 bool TabContents::MaybeUsePreloadedPage(const GURL& url) { | 2855 bool TabContents::MaybeUsePreloadedPage(const GURL& url) { |
| 2850 prerender::PrerenderManager* pm = profile()->GetPrerenderManager(); | 2856 prerender::PrerenderManager* pm = profile()->GetPrerenderManager(); |
| 2851 if (pm != NULL) { | 2857 if (pm != NULL) { |
| 2852 if (pm->MaybeUsePreloadedPage(this, url)) | 2858 if (pm->MaybeUsePreloadedPage(this, url)) |
| 2853 return true; | 2859 return true; |
| 2854 } | 2860 } |
| 2855 return false; | 2861 return false; |
| 2856 } | 2862 } |
| OLD | NEW |