| 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 "base/bind.h" | 7 #include "base/bind.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/common/url_constants.h" |
| 10 #include "content/browser/renderer_host/render_view_host.h" | 11 #include "content/browser/renderer_host/render_view_host.h" |
| 11 #include "content/browser/renderer_host/render_widget_host_view.h" | 12 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 12 #include "views/widget/widget.h" | 13 #include "views/widget/widget.h" |
| 13 #include "ui/aura/desktop.h" | 14 #include "ui/aura/desktop.h" |
| 14 #include "ui/gfx/compositor/layer_animator.h" | 15 #include "ui/gfx/compositor/layer_animator.h" |
| 15 #include "ui/gfx/screen.h" | 16 #include "ui/gfx/screen.h" |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 // Gets preferred bounds of app list window in show/hide state. | 20 // Gets preferred bounds of app list window in show/hide state. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 void AppListWindow::OnActiveWindowChanged(aura::Window* active) { | 85 void AppListWindow::OnActiveWindowChanged(aura::Window* active) { |
| 85 if (widget_ && !widget_->IsActive() && is_visible_) | 86 if (widget_ && !widget_->IsActive() && is_visible_) |
| 86 SetVisible(false, true); | 87 SetVisible(false, true); |
| 87 } | 88 } |
| 88 | 89 |
| 89 void AppListWindow::Init() { | 90 void AppListWindow::Init() { |
| 90 DCHECK(!widget_ && !contents_); | 91 DCHECK(!widget_ && !contents_); |
| 91 | 92 |
| 92 contents_ = new DOMView(); | 93 contents_ = new DOMView(); |
| 93 contents_->Init(ProfileManager::GetDefaultProfile(), NULL); | 94 contents_->Init(ProfileManager::GetDefaultProfile(), NULL); |
| 94 contents_->LoadURL(GURL("chrome://newtab#applist")); | 95 contents_->LoadURL(GURL(chrome::kChromeUIAppListURL)); |
| 95 | 96 |
| 96 // Use a background with transparency to trigger transparent webkit. | 97 // Use a background with transparency to trigger transparent webkit. |
| 97 SkBitmap background; | 98 SkBitmap background; |
| 98 background.setConfig(SkBitmap::kARGB_8888_Config, 1, 1); | 99 background.setConfig(SkBitmap::kARGB_8888_Config, 1, 1); |
| 99 background.allocPixels(); | 100 background.allocPixels(); |
| 100 background.eraseARGB(0x00, 0x00, 0x00, 0x00); | 101 background.eraseARGB(0x00, 0x00, 0x00, 0x00); |
| 101 | 102 |
| 102 TabContents* tab = contents_->dom_contents()->tab_contents(); | 103 TabContents* tab = contents_->dom_contents()->tab_contents(); |
| 103 RenderViewHost* host = tab->render_view_host(); | 104 RenderViewHost* host = tab->render_view_host(); |
| 104 host->view()->SetBackground(background); | 105 host->view()->SetBackground(background); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // TODO(xiyuan): Properly close widget after animation finishes. | 143 // TODO(xiyuan): Properly close widget after animation finishes. |
| 143 MessageLoop::current()->PostDelayedTask( | 144 MessageLoop::current()->PostDelayedTask( |
| 144 FROM_HERE, | 145 FROM_HERE, |
| 145 base::Bind(&views::Widget::Close, base::Unretained(widget_)), | 146 base::Bind(&views::Widget::Close, base::Unretained(widget_)), |
| 146 1000); | 147 1000); |
| 147 } else { | 148 } else { |
| 148 widget_->Close(); | 149 widget_->Close(); |
| 149 } | 150 } |
| 150 } | 151 } |
| 151 } | 152 } |
| OLD | NEW |