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

Side by Side Diff: chrome/browser/extensions/extension_web_ui.cc

Issue 12463042: Shows chrome-extension urls and greys out the whole url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Not hacky anymore Created 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/extension_web_ui.h" 5 #include "chrome/browser/extensions/extension_web_ui.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 "extensions.chrome_url_overrides"; 124 "extensions.chrome_url_overrides";
125 125
126 ExtensionWebUI::ExtensionWebUI(content::WebUI* web_ui, const GURL& url) 126 ExtensionWebUI::ExtensionWebUI(content::WebUI* web_ui, const GURL& url)
127 : WebUIController(web_ui), 127 : WebUIController(web_ui),
128 url_(url) { 128 url_(url) {
129 Profile* profile = Profile::FromWebUI(web_ui); 129 Profile* profile = Profile::FromWebUI(web_ui);
130 ExtensionService* service = profile->GetExtensionService(); 130 ExtensionService* service = profile->GetExtensionService();
131 const Extension* extension = 131 const Extension* extension =
132 service->extensions()->GetExtensionOrAppByURL(ExtensionURLInfo(url)); 132 service->extensions()->GetExtensionOrAppByURL(ExtensionURLInfo(url));
133 DCHECK(extension); 133 DCHECK(extension);
134 // Only hide the url for internal pages (e.g. chrome-extension or packaged 134 // Only don't emphasize host for internal pages (e.g. chrome-extension or
135 // component apps like bookmark manager. 135 // packaged component apps like bookmark manager.
136 bool should_hide_url = !extension->is_hosted_app(); 136 bool should_not_emphasize_host = !extension->is_hosted_app();
137 137
138 // The base class defaults to enabling WebUI bindings, but we don't need 138 // The base class defaults to enabling WebUI bindings, but we don't need
139 // those (this is also reflected in ChromeWebUIControllerFactory:: 139 // those (this is also reflected in ChromeWebUIControllerFactory::
140 // UseWebUIBindingsForURL). 140 // UseWebUIBindingsForURL).
141 int bindings = 0; 141 int bindings = 0;
142 142
143 // Bind externalHost to Extension WebUI loaded in Chrome Frame. 143 // Bind externalHost to Extension WebUI loaded in Chrome Frame.
144 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 144 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
145 if (browser_command_line.HasSwitch(switches::kChromeFrame)) 145 if (browser_command_line.HasSwitch(switches::kChromeFrame))
146 bindings |= content::BINDINGS_POLICY_EXTERNAL_HOST; 146 bindings |= content::BINDINGS_POLICY_EXTERNAL_HOST;
147 // For chrome:// overrides, some of the defaults are a little different. 147 // For chrome:// overrides, some of the defaults are a little different.
148 GURL effective_url = web_ui->GetWebContents()->GetURL(); 148 GURL effective_url = web_ui->GetWebContents()->GetURL();
149 if (effective_url.SchemeIs(chrome::kChromeUIScheme)) { 149 if (effective_url.SchemeIs(chrome::kChromeUIScheme)) {
150 if (effective_url.host() == chrome::kChromeUINewTabHost) { 150 if (effective_url.host() == chrome::kChromeUINewTabHost) {
151 web_ui->FocusLocationBarByDefault(); 151 web_ui->FocusLocationBarByDefault();
152 } else { 152 } else {
153 // Current behavior of other chrome:// pages is to display the URL. 153 // Current behavior of other chrome::// pages is to emphasize URL host.
Devlin 2013/03/27 15:59:52 Don't add an extra :
Patrick Riordan 2013/03/27 19:43:28 Done.
154 should_hide_url = false; 154 should_not_emphasize_host = false;
155 } 155 }
156 } 156 }
157 157
158 if (should_hide_url) 158 if (should_not_emphasize_host)
159 web_ui->HideURL(); 159 web_ui->DontEmphasizeHost();
160 160
161 web_ui->SetBindings(bindings); 161 web_ui->SetBindings(bindings);
162 162
163 // Hack: A few things we specialize just for the bookmark manager. 163 // Hack: A few things we specialize just for the bookmark manager.
164 if (extension->id() == extension_misc::kBookmarkManagerId) { 164 if (extension->id() == extension_misc::kBookmarkManagerId) {
165 bookmark_manager_private_event_router_.reset( 165 bookmark_manager_private_event_router_.reset(
166 new extensions::BookmarkManagerPrivateEventRouter( 166 new extensions::BookmarkManagerPrivateEventRouter(
167 profile, web_ui->GetWebContents())); 167 profile, web_ui->GetWebContents()));
168 168
169 web_ui->SetLinkTransitionType(content::PAGE_TRANSITION_AUTO_BOOKMARK); 169 web_ui->SetLinkTransitionType(content::PAGE_TRANSITION_AUTO_BOOKMARK);
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 extensions::ImageLoader::ImageRepresentation::ALWAYS_RESIZE, 431 extensions::ImageLoader::ImageRepresentation::ALWAYS_RESIZE,
432 gfx::Size(pixel_size, pixel_size), 432 gfx::Size(pixel_size, pixel_size),
433 scale_factors[i])); 433 scale_factors[i]));
434 } 434 }
435 435
436 // LoadImagesAsync actually can run callback synchronously. We want to force 436 // LoadImagesAsync actually can run callback synchronously. We want to force
437 // async. 437 // async.
438 extensions::ImageLoader::Get(profile)->LoadImagesAsync( 438 extensions::ImageLoader::Get(profile)->LoadImagesAsync(
439 extension, info_list, base::Bind(&RunFaviconCallbackAsync, callback)); 439 extension, info_list, base::Bind(&RunFaviconCallbackAsync, callback));
440 } 440 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm » ('j') | chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698