OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 params->current_history_list_length = controller.entry_count(); | 237 params->current_history_list_length = controller.entry_count(); |
238 params->url = entry.url(); | 238 params->url = entry.url(); |
239 params->referrer = entry.referrer(); | 239 params->referrer = entry.referrer(); |
240 params->transition = entry.transition_type(); | 240 params->transition = entry.transition_type(); |
241 params->state = entry.content_state(); | 241 params->state = entry.content_state(); |
242 params->navigation_type = | 242 params->navigation_type = |
243 GetNavigationType(controller.profile(), entry, reload_type); | 243 GetNavigationType(controller.profile(), entry, reload_type); |
244 params->request_time = base::Time::Now(); | 244 params->request_time = base::Time::Now(); |
245 } | 245 } |
246 | 246 |
247 class DisabledPluginInfoBar : public ConfirmInfoBarDelegate { | 247 class OutdatedPluginInfoBar : public ConfirmInfoBarDelegate { |
248 public: | 248 public: |
249 DisabledPluginInfoBar(TabContents* tab_contents, | 249 OutdatedPluginInfoBar(TabContents* tab_contents, |
250 const string16& name, | 250 const string16& name, |
251 const GURL& update_url) | 251 const GURL& update_url) |
252 : ConfirmInfoBarDelegate(tab_contents), | 252 : ConfirmInfoBarDelegate(tab_contents), |
253 tab_contents_(tab_contents), | 253 tab_contents_(tab_contents), |
254 name_(name), | 254 name_(name), |
255 update_url_(update_url) { | 255 update_url_(update_url) { |
256 tab_contents->AddInfoBar(this); | 256 tab_contents->AddInfoBar(this); |
257 } | 257 } |
258 | 258 |
259 virtual int GetButtons() const { | 259 virtual int GetButtons() const { |
(...skipping 21 matching lines...) Expand all Loading... |
281 IDR_INFOBAR_PLUGIN_INSTALL); | 281 IDR_INFOBAR_PLUGIN_INSTALL); |
282 } | 282 } |
283 | 283 |
284 virtual bool Accept() { | 284 virtual bool Accept() { |
285 tab_contents_->OpenURL(update_url_, GURL(), | 285 tab_contents_->OpenURL(update_url_, GURL(), |
286 NEW_FOREGROUND_TAB, PageTransition::LINK); | 286 NEW_FOREGROUND_TAB, PageTransition::LINK); |
287 return false; | 287 return false; |
288 } | 288 } |
289 | 289 |
290 virtual bool Cancel() { | 290 virtual bool Cancel() { |
291 tab_contents_->OpenURL(GURL(chrome::kChromeUIPluginsURL), GURL(), | 291 tab_contents_->render_view_host()->LoadBlockedPlugins(); |
292 NEW_FOREGROUND_TAB, PageTransition::LINK); | 292 return true; |
293 return false; | |
294 } | 293 } |
295 | 294 |
296 virtual bool LinkClicked(WindowOpenDisposition disposition) { | 295 virtual bool LinkClicked(WindowOpenDisposition disposition) { |
297 // TODO(bauerb): Navigate to a help page explaining why we disabled | 296 // TODO(bauerb): Navigate to a help page explaining why we disabled |
298 // the plugin, once we have one. | 297 // the plugin, once we have one. |
299 return false; | 298 return false; |
300 } | 299 } |
301 | 300 |
302 private: | 301 private: |
303 TabContents* tab_contents_; | 302 TabContents* tab_contents_; |
(...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2084 | 2083 |
2085 if (delegate()) | 2084 if (delegate()) |
2086 delegate()->OnDidGetApplicationInfo(this, page_id); | 2085 delegate()->OnDidGetApplicationInfo(this, page_id); |
2087 } | 2086 } |
2088 | 2087 |
2089 void TabContents::OnInstallApplication(const WebApplicationInfo& info) { | 2088 void TabContents::OnInstallApplication(const WebApplicationInfo& info) { |
2090 if (delegate()) | 2089 if (delegate()) |
2091 delegate()->OnInstallApplication(this, info); | 2090 delegate()->OnInstallApplication(this, info); |
2092 } | 2091 } |
2093 | 2092 |
2094 void TabContents::OnDisabledOutdatedPlugin(const string16& name, | 2093 void TabContents::OnBlockedOutdatedPlugin(const string16& name, |
2095 const GURL& update_url) { | 2094 const GURL& update_url) { |
2096 new DisabledPluginInfoBar(this, name, update_url); | 2095 new OutdatedPluginInfoBar(this, name, update_url); |
2097 } | 2096 } |
2098 | 2097 |
2099 void TabContents::OnPageContents(const GURL& url, | 2098 void TabContents::OnPageContents(const GURL& url, |
2100 int renderer_process_id, | 2099 int renderer_process_id, |
2101 int32 page_id, | 2100 int32 page_id, |
2102 const string16& contents, | 2101 const string16& contents, |
2103 const std::string& language, | 2102 const std::string& language, |
2104 bool page_translatable) { | 2103 bool page_translatable) { |
2105 // Don't index any https pages. People generally don't want their bank | 2104 // Don't index any https pages. People generally don't want their bank |
2106 // accounts, etc. indexed on their computer, especially since some of these | 2105 // accounts, etc. indexed on their computer, especially since some of these |
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3301 } | 3300 } |
3302 | 3301 |
3303 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 3302 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
3304 render_manager_.SwapInRenderViewHost(rvh); | 3303 render_manager_.SwapInRenderViewHost(rvh); |
3305 } | 3304 } |
3306 | 3305 |
3307 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 3306 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
3308 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 3307 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
3309 rwh_view->SetSize(view()->GetContainerSize()); | 3308 rwh_view->SetSize(view()->GetContainerSize()); |
3310 } | 3309 } |
OLD | NEW |