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

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

Issue 8985008: Don't use browser windows for platform app shell windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable platform app tests on non-GTK platforms. Created 8 years, 11 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 | « chrome/browser/ui/extensions/shell_window.h ('k') | chrome/browser/ui/gtk/browser_titlebar.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/extensions/shell_window.h"
6
7 #include "chrome/browser/extensions/extension_process_manager.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/common/chrome_notification_types.h"
10 #include "content/public/browser/notification_details.h"
11 #include "content/public/browser/notification_source.h"
12
13 ShellWindow::ShellWindow(ExtensionHost* host)
14 : host_(host) {
15 // Close the window in response to window.close() and the like.
16 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
17 content::Source<Profile>(host->profile()));
18 }
19
20 ShellWindow::~ShellWindow() {
21 }
22
23 ShellWindow* ShellWindow::Create(Profile* profile,
24 const Extension* extension,
25 const GURL& url) {
26 ExtensionProcessManager* manager = profile->GetExtensionProcessManager();
27 DCHECK(manager);
28 if (!manager)
29 return NULL;
30
31 ExtensionHost* host = manager->CreateShellHost(extension, url);
32 // CHECK host so that non-GTK platform compilers don't complain about unused
33 // variables.
34 // TODO(mihaip): remove when ShellWindow has been implemented everywhere.
35 CHECK(host);
36
37 #if defined(TOOLKIT_GTK)
38 // This object will delete itself when the window is closed.
39 // TODO(mihaip): remove the #if block when ShellWindow has been implemented
40 // everywhere.
41 return ShellWindow::CreateShellWindow(host);
42 #endif
43
44 return NULL;
45 }
46
47 void ShellWindow::Observe(int type,
48 const content::NotificationSource& source,
49 const content::NotificationDetails& details) {
50 switch (type) {
51 case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE:
52 if (content::Details<ExtensionHost>(host_.get()) == details)
53 Close();
54 break;
55 default:
56 NOTREACHED() << "Received unexpected notification";
57 }
58 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/extensions/shell_window.h ('k') | chrome/browser/ui/gtk/browser_titlebar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698