| OLD | NEW |
| 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/extensions/extension_process_manager.h" | 7 #include "chrome/browser/extensions/extension_process_manager.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/common/chrome_notification_types.h" | 9 #include "chrome/common/chrome_notification_types.h" |
| 10 #include "content/public/browser/notification_details.h" | 10 #include "content/public/browser/notification_details.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 DCHECK(manager); | 27 DCHECK(manager); |
| 28 if (!manager) | 28 if (!manager) |
| 29 return NULL; | 29 return NULL; |
| 30 | 30 |
| 31 ExtensionHost* host = manager->CreateShellHost(extension, url); | 31 ExtensionHost* host = manager->CreateShellHost(extension, url); |
| 32 // CHECK host so that non-GTK platform compilers don't complain about unused | 32 // CHECK host so that non-GTK platform compilers don't complain about unused |
| 33 // variables. | 33 // variables. |
| 34 // TODO(mihaip): remove when ShellWindow has been implemented everywhere. | 34 // TODO(mihaip): remove when ShellWindow has been implemented everywhere. |
| 35 CHECK(host); | 35 CHECK(host); |
| 36 | 36 |
| 37 #if defined(TOOLKIT_GTK) | 37 #if defined(TOOLKIT_GTK) | defined(TOOLKIT_VIEWS) |
| 38 // This object will delete itself when the window is closed. | 38 // This object will delete itself when the window is closed. |
| 39 // TODO(mihaip): remove the #if block when ShellWindow has been implemented | 39 // TODO(mihaip): remove the #if block when ShellWindow has been implemented |
| 40 // everywhere. | 40 // everywhere. |
| 41 return ShellWindow::CreateShellWindow(host); | 41 return ShellWindow::CreateShellWindow(host); |
| 42 #endif | 42 #endif |
| 43 | 43 |
| 44 return NULL; | 44 return NULL; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void ShellWindow::Observe(int type, | 47 void ShellWindow::Observe(int type, |
| 48 const content::NotificationSource& source, | 48 const content::NotificationSource& source, |
| 49 const content::NotificationDetails& details) { | 49 const content::NotificationDetails& details) { |
| 50 switch (type) { | 50 switch (type) { |
| 51 case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: | 51 case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: |
| 52 if (content::Details<ExtensionHost>(host_.get()) == details) | 52 if (content::Details<ExtensionHost>(host_.get()) == details) |
| 53 Close(); | 53 Close(); |
| 54 break; | 54 break; |
| 55 default: | 55 default: |
| 56 NOTREACHED() << "Received unexpected notification"; | 56 NOTREACHED() << "Received unexpected notification"; |
| 57 } | 57 } |
| 58 } | 58 } |
| OLD | NEW |