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

Side by Side Diff: content/browser/accessibility/accessibility_ui.cc

Issue 25654005: Remove GetActiveEntry usage from content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comment, added TODO, rebased on ToT. Created 7 years, 2 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 | « no previous file | content/browser/renderer_host/render_view_host_unittest.cc » ('j') | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/accessibility/accessibility_ui.h" 5 #include "content/browser/accessibility/accessibility_ui.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 base::DictionaryValue* BuildTargetDescriptor(RenderViewHost* rvh) { 66 base::DictionaryValue* BuildTargetDescriptor(RenderViewHost* rvh) {
67 WebContents* web_contents = WebContents::FromRenderViewHost(rvh); 67 WebContents* web_contents = WebContents::FromRenderViewHost(rvh);
68 std::string title; 68 std::string title;
69 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rvh); 69 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rvh);
70 AccessibilityMode accessibility_mode = rwhi->accessibility_mode(); 70 AccessibilityMode accessibility_mode = rwhi->accessibility_mode();
71 71
72 GURL url; 72 GURL url;
73 GURL favicon_url; 73 GURL favicon_url;
74 if (web_contents) { 74 if (web_contents) {
75 // TODO(nasko): Fix the following code to use a consistent set of data
76 // across the URL, title, and favicon.
75 url = web_contents->GetURL(); 77 url = web_contents->GetURL();
76 title = UTF16ToUTF8(web_contents->GetTitle()); 78 title = UTF16ToUTF8(web_contents->GetTitle());
77 NavigationController& controller = web_contents->GetController(); 79 NavigationController& controller = web_contents->GetController();
78 NavigationEntry* entry = controller.GetActiveEntry(); 80 NavigationEntry* entry = controller.GetVisibleEntry();
79 if (entry != NULL && entry->GetURL().is_valid()) 81 if (entry != NULL && entry->GetURL().is_valid())
80 favicon_url = entry->GetFavicon().url; 82 favicon_url = entry->GetFavicon().url;
81 } 83 }
82 84
83 return BuildTargetDescriptor(url, 85 return BuildTargetDescriptor(url,
84 title, 86 title,
85 favicon_url, 87 favicon_url,
86 rvh->GetProcess()->GetID(), 88 rvh->GetProcess()->GetID(),
87 rvh->GetRoutingID(), 89 rvh->GetRoutingID(),
88 accessibility_mode); 90 accessibility_mode);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 AccessibilityTreeFormatter::Filter::ALLOW)); 248 AccessibilityTreeFormatter::Filter::ALLOW));
247 formatter->SetFilters(filters); 249 formatter->SetFilters(filters);
248 formatter->FormatAccessibilityTree(&accessibility_contents_utf16); 250 formatter->FormatAccessibilityTree(&accessibility_contents_utf16);
249 251
250 result->Set("tree", 252 result->Set("tree",
251 new base::StringValue(UTF16ToUTF8(accessibility_contents_utf16))); 253 new base::StringValue(UTF16ToUTF8(accessibility_contents_utf16)));
252 web_ui()->CallJavascriptFunction("accessibility.showTree", *(result.get())); 254 web_ui()->CallJavascriptFunction("accessibility.showTree", *(result.get()));
253 } 255 }
254 256
255 } // namespace content 257 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_view_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698