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 "chrome/browser/profiles/profile_manager.h" | 7 #include "chrome/browser/profiles/profile_manager.h" |
8 #include "chrome/browser/ui/views/dom_view.h" | 8 #include "chrome/browser/ui/views/dom_view.h" |
9 #include "chrome/browser/ui/webui/aura/app_list_ui.h" | 9 #include "chrome/browser/ui/webui/aura/app_list_ui.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 DCHECK(!widget_ && !contents_); | 92 DCHECK(!widget_ && !contents_); |
93 | 93 |
94 contents_ = new DOMView(); | 94 contents_ = new DOMView(); |
95 contents_->Init(ProfileManager::GetDefaultProfile(), NULL); | 95 contents_->Init(ProfileManager::GetDefaultProfile(), NULL); |
96 | 96 |
97 TabContents* tab = contents_->dom_contents()->tab_contents(); | 97 TabContents* tab = contents_->dom_contents()->tab_contents(); |
98 tab_watcher_.reset(new TabFirstRenderWatcher(tab, this)); | 98 tab_watcher_.reset(new TabFirstRenderWatcher(tab, this)); |
99 tab->SetDelegate(this); | 99 tab->SetDelegate(this); |
100 | 100 |
101 contents_->LoadURL(GURL(chrome::kChromeUIAppListURL)); | 101 contents_->LoadURL(GURL(chrome::kChromeUIAppListURL)); |
102 static_cast<AppListUI*>(tab->web_ui())->set_delegate(this); | 102 static_cast<AppListUI*>(tab->GetWebUI())->set_delegate(this); |
103 | 103 |
104 // Use a background with transparency to trigger transparent webkit. | 104 // Use a background with transparency to trigger transparent webkit. |
105 SkBitmap background; | 105 SkBitmap background; |
106 background.setConfig(SkBitmap::kARGB_8888_Config, 1, 1); | 106 background.setConfig(SkBitmap::kARGB_8888_Config, 1, 1); |
107 background.allocPixels(); | 107 background.allocPixels(); |
108 background.eraseARGB(0x00, 0x00, 0x00, 0x00); | 108 background.eraseARGB(0x00, 0x00, 0x00, 0x00); |
109 | 109 |
110 RenderViewHost* host = tab->GetRenderViewHost(); | 110 RenderViewHost* host = tab->GetRenderViewHost(); |
111 host->view()->SetBackground(background); | 111 host->view()->SetBackground(background); |
112 | 112 |
113 views::Widget::InitParams widget_params( | 113 views::Widget::InitParams widget_params( |
114 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 114 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
115 widget_params.bounds = bounds; | 115 widget_params.bounds = bounds; |
116 widget_params.delegate = this; | 116 widget_params.delegate = this; |
117 widget_params.keep_on_top = true; | 117 widget_params.keep_on_top = true; |
118 widget_params.transparent = true; | 118 widget_params.transparent = true; |
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 |