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

Unified Diff: chrome/browser/extensions/api/app_window/app_window_api.cc

Issue 11048045: Allow settings dialog to be opened via the app launcher, as a packaged app. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: license stanza Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browser_resources.grd ('k') | chrome/browser/extensions/component_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/app_window/app_window_api.cc
diff --git a/chrome/browser/extensions/api/app_window/app_window_api.cc b/chrome/browser/extensions/api/app_window/app_window_api.cc
index 97dcd1c195d11743b658a43e703b42493dce3964..34e855581da5ec160f0edbce45c32c6757d2c38b 100644
--- a/chrome/browser/extensions/api/app_window/app_window_api.cc
+++ b/chrome/browser/extensions/api/app_window/app_window_api.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/ui/extensions/shell_window.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/api/app_window.h"
+#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h"
@@ -35,6 +36,13 @@ bool AppWindowCreateFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params.get());
GURL url = GetExtension()->GetResourceURL(params->url);
+ // Allow absolute URLs for component apps, otherwise prepend the extension
+ // path.
+ if (GetExtension()->location() == extensions::Extension::COMPONENT) {
+ GURL absolute = GURL(params->url);
+ if (absolute.has_scheme())
+ url = absolute;
+ }
bool inject_html_titlebar = false;
@@ -123,12 +131,19 @@ bool AppWindowCreateFunction::RunImpl() {
if (create_params.bounds.height() < minimum_size.height())
create_params.bounds.set_height(minimum_size.height());
}
+
+ create_params.creator_process_id =
+ render_view_host_->GetProcess()->GetID();
+
ShellWindow* shell_window =
ShellWindow::Create(profile(), GetExtension(), url, create_params);
shell_window->GetBaseWindow()->Show();
- content::WebContents* created_contents = shell_window->web_contents();
- int view_id = created_contents->GetRenderViewHost()->GetRoutingID();
+ content::RenderViewHost* created_view =
+ shell_window->web_contents()->GetRenderViewHost();
+ int view_id = MSG_ROUTING_NONE;
+ if (create_params.creator_process_id == created_view->GetProcess()->GetID())
+ view_id = created_view->GetRoutingID();
base::DictionaryValue* result = new base::DictionaryValue;
result->Set("viewId", base::Value::CreateIntegerValue(view_id));
« no previous file with comments | « chrome/browser/browser_resources.grd ('k') | chrome/browser/extensions/component_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698