| 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/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1985 NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index); | 1985 NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index); |
| 1986 | 1986 |
| 1987 if (state == entry->content_state()) | 1987 if (state == entry->content_state()) |
| 1988 return; // Nothing to update. | 1988 return; // Nothing to update. |
| 1989 entry->set_content_state(state); | 1989 entry->set_content_state(state); |
| 1990 controller_.NotifyEntryChanged(entry, entry_index); | 1990 controller_.NotifyEntryChanged(entry, entry_index); |
| 1991 } | 1991 } |
| 1992 | 1992 |
| 1993 void TabContents::UpdateTitle(RenderViewHost* rvh, | 1993 void TabContents::UpdateTitle(RenderViewHost* rvh, |
| 1994 int32 page_id, | 1994 int32 page_id, |
| 1995 const string16& title, | 1995 const base::i18n::String16WithDirection& title) { |
| 1996 WebKit::WebTextDirection title_direction) { | |
| 1997 // If we have a title, that's a pretty good indication that we've started | 1996 // If we have a title, that's a pretty good indication that we've started |
| 1998 // getting useful data. | 1997 // getting useful data. |
| 1999 SetNotWaitingForResponse(); | 1998 SetNotWaitingForResponse(); |
| 2000 | 1999 |
| 2001 DCHECK(rvh == render_view_host()); | 2000 DCHECK(rvh == render_view_host()); |
| 2002 NavigationEntry* entry = controller_.GetEntryWithPageID(rvh->site_instance(), | 2001 NavigationEntry* entry = controller_.GetEntryWithPageID(rvh->site_instance(), |
| 2003 page_id); | 2002 page_id); |
| 2004 // TODO(evan): use directionality of title. | 2003 // TODO(evan): use directionality of title. |
| 2005 // http://code.google.com/p/chromium/issues/detail?id=27094 | 2004 // http://code.google.com/p/chromium/issues/detail?id=27094 |
| 2006 if (!entry || !UpdateTitleForEntry(entry, UTF16ToWide(title))) | 2005 if (!entry || !UpdateTitleForEntry(entry, UTF16ToWide(title.string()))) |
| 2007 return; | 2006 return; |
| 2008 | 2007 |
| 2009 // Broadcast notifications when the UI should be updated. | 2008 // Broadcast notifications when the UI should be updated. |
| 2010 if (entry == controller_.GetEntryAtOffset(0)) | 2009 if (entry == controller_.GetEntryAtOffset(0)) |
| 2011 NotifyNavigationStateChanged(INVALIDATE_TITLE); | 2010 NotifyNavigationStateChanged(INVALIDATE_TITLE); |
| 2012 } | 2011 } |
| 2013 | 2012 |
| 2014 void TabContents::UpdateEncoding(RenderViewHost* render_view_host, | 2013 void TabContents::UpdateEncoding(RenderViewHost* render_view_host, |
| 2015 const std::string& encoding) { | 2014 const std::string& encoding) { |
| 2016 set_encoding(encoding); | 2015 set_encoding(encoding); |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2544 | 2543 |
| 2545 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2544 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 2546 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2545 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 2547 rwh_view->SetSize(view()->GetContainerSize()); | 2546 rwh_view->SetSize(view()->GetContainerSize()); |
| 2548 } | 2547 } |
| 2549 | 2548 |
| 2550 void TabContents::OnOnlineStateChanged(bool online) { | 2549 void TabContents::OnOnlineStateChanged(bool online) { |
| 2551 render_view_host()->Send(new ViewMsg_NetworkStateChanged( | 2550 render_view_host()->Send(new ViewMsg_NetworkStateChanged( |
| 2552 render_view_host()->routing_id(), online)); | 2551 render_view_host()->routing_id(), online)); |
| 2553 } | 2552 } |
| OLD | NEW |