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

Side by Side Diff: chrome/browser/ui/extensions/shell_window.cc

Issue 10387074: Only disallow top-level navigations in platform apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mike's review feedback Created 8 years, 7 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
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/ui/extensions/shell_window.h" 5 #include "chrome/browser/ui/extensions/shell_window.h"
6 6
7 #include "chrome/browser/ui/browser_list.h" 7 #include "chrome/browser/ui/browser_list.h"
8 #include "chrome/browser/extensions/extension_process_manager.h" 8 #include "chrome/browser/extensions/extension_process_manager.h"
9 #include "chrome/browser/extensions/extension_tabs_module_constants.h" 9 #include "chrome/browser/extensions/extension_tabs_module_constants.h"
10 #include "chrome/browser/extensions/extension_window_controller.h" 10 #include "chrome/browser/extensions/extension_window_controller.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 : profile_(profile), 91 : profile_(profile),
92 extension_(extension), 92 extension_(extension),
93 ALLOW_THIS_IN_INITIALIZER_LIST( 93 ALLOW_THIS_IN_INITIALIZER_LIST(
94 extension_function_dispatcher_(profile, this)) { 94 extension_function_dispatcher_(profile, this)) {
95 web_contents_.reset(WebContents::Create( 95 web_contents_.reset(WebContents::Create(
96 profile, SiteInstance::CreateForURL(profile, url), MSG_ROUTING_NONE, NULL, 96 profile, SiteInstance::CreateForURL(profile, url), MSG_ROUTING_NONE, NULL,
97 NULL)); 97 NULL));
98 content::WebContentsObserver::Observe(web_contents_.get()); 98 content::WebContentsObserver::Observe(web_contents_.get());
99 web_contents_->SetDelegate(this); 99 web_contents_->SetDelegate(this);
100 web_contents_->SetViewType(chrome::VIEW_TYPE_APP_SHELL); 100 web_contents_->SetViewType(chrome::VIEW_TYPE_APP_SHELL);
101 web_contents_->GetMutableRendererPrefs()->browser_handles_all_requests = 101 web_contents_->GetMutableRendererPrefs()->
102 true; 102 browser_handles_all_top_level_or_non_local_requests = true;
103 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); 103 web_contents_->GetRenderViewHost()->SyncRendererPrefs();
104 104
105 web_contents_->GetController().LoadURL( 105 web_contents_->GetController().LoadURL(
106 url, content::Referrer(), content::PAGE_TRANSITION_LINK, 106 url, content::Referrer(), content::PAGE_TRANSITION_LINK,
107 std::string()); 107 std::string());
108 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 108 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
109 content::Source<Profile>(profile_)); 109 content::Source<Profile>(profile_));
110 // Close when the browser is exiting. 110 // Close when the browser is exiting.
111 // TODO(mihaip): we probably don't want this in the long run (when platform 111 // TODO(mihaip): we probably don't want this in the long run (when platform
112 // apps are no longer tied to the browser process). 112 // apps are no longer tied to the browser process).
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 174 }
175 175
176 ExtensionWindowController* ShellWindow::GetExtensionWindowController() const { 176 ExtensionWindowController* ShellWindow::GetExtensionWindowController() const {
177 return extension_window_controller_.get(); 177 return extension_window_controller_.get();
178 } 178 }
179 179
180 void ShellWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) { 180 void ShellWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) {
181 extension_function_dispatcher_.Dispatch(params, 181 extension_function_dispatcher_.Dispatch(params,
182 web_contents_->GetRenderViewHost()); 182 web_contents_->GetRenderViewHost());
183 } 183 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698