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