| 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/app_list_window.h" | 5 #include "chrome/browser/ui/views/aura/app_list_window.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
| 9 #include "chrome/browser/ui/views/dom_view.h" | 9 #include "chrome/browser/ui/views/dom_view.h" |
| 10 #include "chrome/browser/ui/webui/aura/app_list_ui.h" | 10 #include "chrome/browser/ui/webui/aura/app_list_ui.h" |
| 11 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
| 12 #include "content/browser/renderer_host/render_view_host.h" | 12 #include "content/browser/renderer_host/render_view_host.h" |
| 13 #include "content/browser/renderer_host/render_widget_host_view.h" | 13 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 14 #include "content/browser/tab_contents/tab_contents.h" | 14 #include "content/browser/tab_contents/tab_contents.h" |
| 15 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
| 16 | 16 |
| 17 AppListWindow::AppListWindow(const gfx::Rect& bounds, | 17 AppListWindow::AppListWindow(const gfx::Rect& bounds, |
| 18 const aura_shell::ShellDelegate::SetWidgetCallback& callback) | 18 const ash::ShellDelegate::SetWidgetCallback& callback) |
| 19 : widget_(NULL), | 19 : widget_(NULL), |
| 20 contents_(NULL), | 20 contents_(NULL), |
| 21 callback_(callback), | 21 callback_(callback), |
| 22 content_rendered_(false), | 22 content_rendered_(false), |
| 23 apps_loaded_(false) { | 23 apps_loaded_(false) { |
| 24 Init(bounds); | 24 Init(bounds); |
| 25 } | 25 } |
| 26 | 26 |
| 27 AppListWindow::~AppListWindow() { | 27 AppListWindow::~AppListWindow() { |
| 28 } | 28 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 void AppListWindow::OnTabMainFrameLoaded() { | 73 void AppListWindow::OnTabMainFrameLoaded() { |
| 74 } | 74 } |
| 75 | 75 |
| 76 void AppListWindow::OnTabMainFrameFirstRender() { | 76 void AppListWindow::OnTabMainFrameFirstRender() { |
| 77 content_rendered_ = true; | 77 content_rendered_ = true; |
| 78 SetWidgetIfReady(); | 78 SetWidgetIfReady(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void AppListWindow::Close() { | 81 void AppListWindow::Close() { |
| 82 // We should be visible when running here and toggle actually closes us. | 82 // We should be visible when running here and toggle actually closes us. |
| 83 aura_shell::Shell::GetInstance()->ToggleAppList(); | 83 ash::Shell::GetInstance()->ToggleAppList(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void AppListWindow::OnAppsLoaded() { | 86 void AppListWindow::OnAppsLoaded() { |
| 87 apps_loaded_ = true; | 87 apps_loaded_ = true; |
| 88 SetWidgetIfReady(); | 88 SetWidgetIfReady(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void AppListWindow::Init(const gfx::Rect& bounds) { | 91 void AppListWindow::Init(const gfx::Rect& bounds) { |
| 92 DCHECK(!widget_ && !contents_); | 92 DCHECK(!widget_ && !contents_); |
| 93 | 93 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 119 | 119 |
| 120 widget_ = new views::Widget; | 120 widget_ = new views::Widget; |
| 121 widget_->Init(widget_params); | 121 widget_->Init(widget_params); |
| 122 widget_->SetContentsView(contents_); | 122 widget_->SetContentsView(contents_); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void AppListWindow::SetWidgetIfReady() { | 125 void AppListWindow::SetWidgetIfReady() { |
| 126 if (content_rendered_ && apps_loaded_) | 126 if (content_rendered_ && apps_loaded_) |
| 127 callback_.Run(widget_); | 127 callback_.Run(widget_); |
| 128 } | 128 } |
| OLD | NEW |