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

Unified Diff: chrome/browser/ui/extensions/shell_window.cc

Issue 10920084: don't display platform app resources in normal browser windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser_window.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/extensions/shell_window.cc
diff --git a/chrome/browser/ui/extensions/shell_window.cc b/chrome/browser/ui/extensions/shell_window.cc
index bcfe4d28c14d6a0ffc9add047aea9043438e5922..3835d560cafa0fad879ffe915438fae600c0b6ab 100644
--- a/chrome/browser/ui/extensions/shell_window.cc
+++ b/chrome/browser/ui/extensions/shell_window.cc
@@ -210,30 +210,7 @@ WebContents* ShellWindow::OpenURLFromTab(WebContents* source,
const content::OpenURLParams& params) {
DCHECK(source == web_contents_);
- if (params.url.host() == extension_->id()) {
- AddMessageToDevToolsConsole(
- content::CONSOLE_MESSAGE_LEVEL_ERROR,
- base::StringPrintf(
- "Can't navigate to \"%s\"; apps do not support navigation.",
- params.url.spec().c_str()));
- return NULL;
- }
-
- // Don't allow the current tab to be navigated. It would be nice to map all
Evan Stade 2012/09/06 18:29:52 you can view this change as a proposal. Here is a
Mihai Parparita -not on Chrome 2012/09/06 18:40:35 This seems OK to me. To make it more obvious in th
- // anchor tags (even those without target="_blank") to new tabs, but right
- // now we can't distinguish between those and <meta> refreshes, which we
- // don't want to allow.
- // TOOD(mihaip): Can we check for user gestures instead?
WindowOpenDisposition disposition = params.disposition;
- if (disposition == CURRENT_TAB) {
- AddMessageToDevToolsConsole(
- content::CONSOLE_MESSAGE_LEVEL_ERROR,
- base::StringPrintf(
- "Can't open same-window link to \"%s\"; try target=\"_blank\".",
- params.url.spec().c_str()));
- return NULL;
- }
-
// These dispositions aren't really navigations.
if (disposition == SUPPRESS_OPEN || disposition == SAVE_TO_DISK ||
disposition == IGNORE_ACTION) {
@@ -242,13 +219,24 @@ WebContents* ShellWindow::OpenURLFromTab(WebContents* source,
// Force all links to open in a new tab, even if they were trying to open a
// window.
- content::OpenURLParams new_tab_params = params;
+ chrome::NavigateParams new_tab_params(
+ static_cast<Browser*>(NULL), params.url, params.transition);
new_tab_params.disposition =
disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB;
- Browser* browser = browser::FindOrCreateTabbedBrowser(profile_);
- WebContents* new_tab = browser->OpenURL(new_tab_params);
- browser->window()->Show();
- return new_tab;
+ new_tab_params.initiating_profile = profile_;
+ chrome::Navigate(&new_tab_params);
+
+ WebContents* new_contents = new_tab_params.target_contents ?
+ new_tab_params.target_contents->web_contents() : NULL;
+ if (!new_contents) {
+ AddMessageToDevToolsConsole(
+ content::CONSOLE_MESSAGE_LEVEL_ERROR,
+ base::StringPrintf(
+ "Can't navigate to \"%s\"; apps do not support navigation.",
+ params.url.spec().c_str()));
+ }
+
+ return new_contents;
}
void ShellWindow::AddNewContents(WebContents* source,
« no previous file with comments | « chrome/browser/ui/browser_window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698