Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/views/aura/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile_manager.h" | 7 #include "chrome/browser/profiles/profile_manager.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/views/aura/app_list_window.h" | 9 #include "chrome/browser/ui/views/aura/app_list_window.h" |
| 10 #include "chrome/browser/ui/views/aura/status_area_host_aura.h" | 10 #include "chrome/browser/ui/views/aura/status_area_host_aura.h" |
| 11 #include "chrome/browser/ui/views/frame/browser_view.h" | 11 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 12 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
| 13 #include "ui/aura_shell/shell.h" | |
|
sky
2011/12/12 15:46:29
sort
James Cook
2011/12/12 18:33:36
Done.
| |
| 13 #include "ui/aura_shell/launcher/launcher_types.h" | 14 #include "ui/aura_shell/launcher/launcher_types.h" |
| 14 | 15 |
| 15 // static | 16 // static |
| 16 ChromeShellDelegate* ChromeShellDelegate::instance_ = NULL; | 17 ChromeShellDelegate* ChromeShellDelegate::instance_ = NULL; |
| 17 | 18 |
| 18 ChromeShellDelegate::ChromeShellDelegate() { | 19 ChromeShellDelegate::ChromeShellDelegate() { |
| 19 instance_ = this; | 20 instance_ = this; |
| 20 } | 21 } |
| 21 | 22 |
| 22 ChromeShellDelegate::~ChromeShellDelegate() { | 23 ChromeShellDelegate::~ChromeShellDelegate() { |
| 23 if (instance_ == this) | 24 if (instance_ == this) |
| 24 instance_ = NULL; | 25 instance_ = NULL; |
| 25 } | 26 } |
| 26 | 27 |
| 27 StatusAreaView* ChromeShellDelegate::GetStatusArea() { | 28 StatusAreaView* ChromeShellDelegate::GetStatusArea() { |
| 28 return status_area_host_->GetStatusArea(); | 29 return status_area_host_->GetStatusArea(); |
| 29 } | 30 } |
| 30 | 31 |
| 31 // static | 32 // static |
| 32 bool ChromeShellDelegate::ShouldCreateLauncherItemForBrowser( | 33 bool ChromeShellDelegate::ShouldCreateLauncherItemForBrowser( |
| 33 Browser* browser, | 34 Browser* browser, |
| 34 aura_shell::LauncherItemType* type) { | 35 aura_shell::LauncherItemType* type) { |
| 36 // Don't create items if we don't have a launcher at all. | |
| 37 if (!aura_shell::Shell::GetInstance()->launcher()) | |
|
sky
2011/12/12 15:46:29
It doesn't seem like you create the launcher, so t
James Cook
2011/12/12 18:33:36
I was using this to avoid a null-check in BrowserV
| |
| 38 return false; | |
| 35 if (browser->type() == Browser::TYPE_TABBED) { | 39 if (browser->type() == Browser::TYPE_TABBED) { |
| 36 *type = aura_shell::TYPE_TABBED; | 40 *type = aura_shell::TYPE_TABBED; |
| 37 return true; | 41 return true; |
| 38 } | 42 } |
| 39 if (browser->is_app()) { | 43 if (browser->is_app()) { |
| 40 *type = aura_shell::TYPE_APP; | 44 *type = aura_shell::TYPE_APP; |
| 41 return true; | 45 return true; |
| 42 } | 46 } |
| 43 return false; | 47 return false; |
| 44 } | 48 } |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 68 const aura_shell::LauncherItem& item) { | 72 const aura_shell::LauncherItem& item) { |
| 69 item.window->Activate(); | 73 item.window->Activate(); |
| 70 } | 74 } |
| 71 | 75 |
| 72 bool ChromeShellDelegate::ConfigureLauncherItem( | 76 bool ChromeShellDelegate::ConfigureLauncherItem( |
| 73 aura_shell::LauncherItem* item) { | 77 aura_shell::LauncherItem* item) { |
| 74 BrowserView* view = BrowserView::GetBrowserViewForNativeWindow(item->window); | 78 BrowserView* view = BrowserView::GetBrowserViewForNativeWindow(item->window); |
| 75 return view && | 79 return view && |
| 76 ShouldCreateLauncherItemForBrowser(view->browser(), &(item->type)); | 80 ShouldCreateLauncherItemForBrowser(view->browser(), &(item->type)); |
| 77 } | 81 } |
| OLD | NEW |