| 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 "ash/launcher/launcher_types.h" | 7 #include "ash/launcher/launcher_types.h" |
| 8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
| 9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 instance_ = NULL; | 27 instance_ = NULL; |
| 28 } | 28 } |
| 29 | 29 |
| 30 StatusAreaView* ChromeShellDelegate::GetStatusArea() { | 30 StatusAreaView* ChromeShellDelegate::GetStatusArea() { |
| 31 return status_area_host_->GetStatusArea(); | 31 return status_area_host_->GetStatusArea(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 // static | 34 // static |
| 35 bool ChromeShellDelegate::ShouldCreateLauncherItemForBrowser( | 35 bool ChromeShellDelegate::ShouldCreateLauncherItemForBrowser( |
| 36 Browser* browser, | 36 Browser* browser, |
| 37 aura_shell::LauncherItemType* type) { | 37 ash::LauncherItemType* type) { |
| 38 if (browser->type() == Browser::TYPE_TABBED) { | 38 if (browser->type() == Browser::TYPE_TABBED) { |
| 39 *type = aura_shell::TYPE_TABBED; | 39 *type = ash::TYPE_TABBED; |
| 40 return true; | 40 return true; |
| 41 } | 41 } |
| 42 if (browser->is_app()) { | 42 if (browser->is_app()) { |
| 43 *type = aura_shell::TYPE_APP; | 43 *type = ash::TYPE_APP; |
| 44 return true; | 44 return true; |
| 45 } | 45 } |
| 46 return false; | 46 return false; |
| 47 } | 47 } |
| 48 | 48 |
| 49 void ChromeShellDelegate::CreateNewWindow() { | 49 void ChromeShellDelegate::CreateNewWindow() { |
| 50 Browser* browser = Browser::Create(ProfileManager::GetDefaultProfile()); | 50 Browser* browser = Browser::Create(ProfileManager::GetDefaultProfile()); |
| 51 browser->AddSelectedTabWithURL(GURL(), content::PAGE_TRANSITION_START_PAGE); | 51 browser->AddSelectedTabWithURL(GURL(), content::PAGE_TRANSITION_START_PAGE); |
| 52 browser->window()->Show(); | 52 browser->window()->Show(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 views::Widget* ChromeShellDelegate::CreateStatusArea() { | 55 views::Widget* ChromeShellDelegate::CreateStatusArea() { |
| 56 status_area_host_.reset(new StatusAreaHostAura()); | 56 status_area_host_.reset(new StatusAreaHostAura()); |
| 57 views::Widget* status_area_widget = | 57 views::Widget* status_area_widget = |
| 58 status_area_host_.get()->CreateStatusArea(); | 58 status_area_host_.get()->CreateStatusArea(); |
| 59 return status_area_widget; | 59 return status_area_widget; |
| 60 } | 60 } |
| 61 | 61 |
| 62 void ChromeShellDelegate::RequestAppListWidget( | 62 void ChromeShellDelegate::RequestAppListWidget( |
| 63 const gfx::Rect& bounds, | 63 const gfx::Rect& bounds, |
| 64 const SetWidgetCallback& callback) { | 64 const SetWidgetCallback& callback) { |
| 65 // AppListWindow deletes itself when closed. | 65 // AppListWindow deletes itself when closed. |
| 66 new AppListWindow(bounds, callback); | 66 new AppListWindow(bounds, callback); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void ChromeShellDelegate::BuildAppListModel(aura_shell::AppListModel* model) { | 69 void ChromeShellDelegate::BuildAppListModel(ash::AppListModel* model) { |
| 70 AppListModelBuilder builder(ProfileManager::GetDefaultProfile(), | 70 AppListModelBuilder builder(ProfileManager::GetDefaultProfile(), |
| 71 model); | 71 model); |
| 72 builder.Build(); | 72 builder.Build(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 aura_shell::AppListViewDelegate* | 75 ash::AppListViewDelegate* |
| 76 ChromeShellDelegate::CreateAppListViewDelegate() { | 76 ChromeShellDelegate::CreateAppListViewDelegate() { |
| 77 // Shell will own the created delegate. | 77 // Shell will own the created delegate. |
| 78 return new AppListViewDelegate; | 78 return new AppListViewDelegate; |
| 79 } | 79 } |
| 80 | 80 |
| 81 void ChromeShellDelegate::LauncherItemClicked( | 81 void ChromeShellDelegate::LauncherItemClicked( |
| 82 const aura_shell::LauncherItem& item) { | 82 const ash::LauncherItem& item) { |
| 83 aura_shell::ActivateWindow(item.window); | 83 ash::ActivateWindow(item.window); |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool ChromeShellDelegate::ConfigureLauncherItem( | 86 bool ChromeShellDelegate::ConfigureLauncherItem( |
| 87 aura_shell::LauncherItem* item) { | 87 ash::LauncherItem* item) { |
| 88 BrowserView* view = BrowserView::GetBrowserViewForNativeWindow(item->window); | 88 BrowserView* view = BrowserView::GetBrowserViewForNativeWindow(item->window); |
| 89 return view && | 89 return view && |
| 90 ShouldCreateLauncherItemForBrowser(view->browser(), &(item->type)); | 90 ShouldCreateLauncherItemForBrowser(view->browser(), &(item->type)); |
| 91 } | 91 } |
| OLD | NEW |