Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1553)

Side by Side Diff: content/renderer/render_view.cc

Issue 6901003: Revert my recent changes regarding title directionality. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyrights Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/renderer/render_view.h" 5 #include "content/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 1094
1095 // Check if the navigation was within the same page, in which case we don't 1095 // Check if the navigation was within the same page, in which case we don't
1096 // want to clear the accessibility cache. 1096 // want to clear the accessibility cache.
1097 if (accessibility_.get() && !navigation_state->was_within_same_page()) { 1097 if (accessibility_.get() && !navigation_state->was_within_same_page()) {
1098 accessibility_.reset(); 1098 accessibility_.reset();
1099 pending_accessibility_notifications_.clear(); 1099 pending_accessibility_notifications_.clear();
1100 } 1100 }
1101 } 1101 }
1102 1102
1103 // Tell the embedding application that the title of the active page has changed 1103 // Tell the embedding application that the title of the active page has changed
1104 void RenderView::UpdateTitle(WebFrame* frame, const string16& title, 1104 void RenderView::UpdateTitle(WebFrame* frame, const string16& title) {
1105 WebTextDirection title_direction) {
1106 // Ignore all but top level navigations... 1105 // Ignore all but top level navigations...
1107 if (!frame->parent()) { 1106 if (!frame->parent()) {
1108 Send(new ViewHostMsg_UpdateTitle( 1107 Send(new ViewHostMsg_UpdateTitle(
1109 routing_id_, 1108 routing_id_,
1110 page_id_, 1109 page_id_,
1111 title.length() > content::kMaxTitleChars ? 1110 UTF16ToWideHack(title.length() > content::kMaxTitleChars ?
1112 title.substr(0, content::kMaxTitleChars) : title, 1111 title.substr(0, content::kMaxTitleChars) : title)));
1113 title_direction));
1114 } 1112 }
1115 } 1113 }
1116 1114
1117 void RenderView::UpdateEncoding(WebFrame* frame, 1115 void RenderView::UpdateEncoding(WebFrame* frame,
1118 const std::string& encoding_name) { 1116 const std::string& encoding_name) {
1119 // Only update main frame's encoding_name. 1117 // Only update main frame's encoding_name.
1120 if (webview()->mainFrame() == frame && 1118 if (webview()->mainFrame() == frame &&
1121 last_encoding_name_ != encoding_name) { 1119 last_encoding_name_ != encoding_name) {
1122 // Save the encoding name for later comparing. 1120 // Save the encoding name for later comparing.
1123 last_encoding_name_ = encoding_name; 1121 last_encoding_name_ = encoding_name;
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
2447 if (frame == webview()->mainFrame()) 2445 if (frame == webview()->mainFrame())
2448 Send(new ViewHostMsg_DocumentAvailableInMainFrame(routing_id_)); 2446 Send(new ViewHostMsg_DocumentAvailableInMainFrame(routing_id_));
2449 } 2447 }
2450 2448
2451 FOR_EACH_OBSERVER(RenderViewObserver, observers_, 2449 FOR_EACH_OBSERVER(RenderViewObserver, observers_,
2452 DidCreateDocumentElement(frame)); 2450 DidCreateDocumentElement(frame));
2453 } 2451 }
2454 2452
2455 void RenderView::didReceiveTitle(WebFrame* frame, const WebString& title, 2453 void RenderView::didReceiveTitle(WebFrame* frame, const WebString& title,
2456 WebTextDirection direction) { 2454 WebTextDirection direction) {
2457 UpdateTitle(frame, title, direction); 2455 // TODO: pass direction through various APIs.
2456 // http://code.google.com/p/chromium/issues/detail?id=79903
2457 UpdateTitle(frame, title);
2458 2458
2459 // Also check whether we have new encoding name. 2459 // Also check whether we have new encoding name.
2460 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); 2460 UpdateEncoding(frame, frame->view()->pageEncoding().utf8());
2461 } 2461 }
2462 2462
2463 void RenderView::didChangeIcons(WebFrame* frame) { 2463 void RenderView::didChangeIcons(WebFrame* frame) {
2464 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidChangeIcons(frame)); 2464 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidChangeIcons(frame));
2465 } 2465 }
2466 2466
2467 void RenderView::didFinishDocumentLoad(WebFrame* frame) { 2467 void RenderView::didFinishDocumentLoad(WebFrame* frame) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2511 // existing navigation state to a content-initiated navigation state. 2511 // existing navigation state to a content-initiated navigation state.
2512 // DidCreateDataSource conveniently takes care of this for us. 2512 // DidCreateDataSource conveniently takes care of this for us.
2513 didCreateDataSource(frame, frame->dataSource()); 2513 didCreateDataSource(frame, frame->dataSource());
2514 2514
2515 NavigationState* new_state = 2515 NavigationState* new_state =
2516 NavigationState::FromDataSource(frame->dataSource()); 2516 NavigationState::FromDataSource(frame->dataSource());
2517 new_state->set_was_within_same_page(true); 2517 new_state->set_was_within_same_page(true);
2518 2518
2519 didCommitProvisionalLoad(frame, is_new_navigation); 2519 didCommitProvisionalLoad(frame, is_new_navigation);
2520 2520
2521 // TODO(evan): update this to use ->pageTitleDirection() once we pull in new 2521 UpdateTitle(frame, frame->view()->mainFrame()->dataSource()->pageTitle());
2522 // WebKit.
2523 UpdateTitle(frame, frame->view()->mainFrame()->dataSource()->pageTitle(),
2524 WebKit::WebTextDirectionLeftToRight);
2525 } 2522 }
2526 2523
2527 void RenderView::didUpdateCurrentHistoryItem(WebFrame* frame) { 2524 void RenderView::didUpdateCurrentHistoryItem(WebFrame* frame) {
2528 StartNavStateSyncTimerIfNecessary(); 2525 StartNavStateSyncTimerIfNecessary();
2529 } 2526 }
2530 2527
2531 void RenderView::assignIdentifierToRequest( 2528 void RenderView::assignIdentifierToRequest(
2532 WebFrame* frame, unsigned identifier, const WebURLRequest& request) { 2529 WebFrame* frame, unsigned identifier, const WebURLRequest& request) {
2533 // Ignore 2530 // Ignore
2534 } 2531 }
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after
4225 const webkit_glue::CustomContextMenuContext& custom_context) { 4222 const webkit_glue::CustomContextMenuContext& custom_context) {
4226 if (custom_context.is_pepper_menu) 4223 if (custom_context.is_pepper_menu)
4227 pepper_delegate_.OnContextMenuClosed(custom_context); 4224 pepper_delegate_.OnContextMenuClosed(custom_context);
4228 else 4225 else
4229 context_menu_node_.reset(); 4226 context_menu_node_.reset();
4230 } 4227 }
4231 4228
4232 void RenderView::OnNetworkStateChanged(bool online) { 4229 void RenderView::OnNetworkStateChanged(bool online) {
4233 WebNetworkStateNotifier::setOnLine(online); 4230 WebNetworkStateNotifier::setOnLine(online);
4234 } 4231 }
OLDNEW
« no previous file with comments | « content/renderer/render_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698