OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/chromeos/wm_overview_snapshot.h" | 5 #include "chrome/browser/chromeos/wm_overview_snapshot.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "app/x11_util.h" | |
10 #include "chrome/browser/browser_window.h" | 9 #include "chrome/browser/browser_window.h" |
11 #include "chrome/browser/chromeos/wm_ipc.h" | 10 #include "chrome/browser/chromeos/wm_ipc.h" |
12 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "ui/base/x/x11_util.h" |
13 #include "views/controls/image_view.h" | 13 #include "views/controls/image_view.h" |
14 #include "views/controls/label.h" | 14 #include "views/controls/label.h" |
15 #include "views/grid_layout.h" | 15 #include "views/grid_layout.h" |
16 | 16 |
17 using std::vector; | 17 using std::vector; |
18 | 18 |
19 #if !defined(OS_CHROMEOS) | 19 #if !defined(OS_CHROMEOS) |
20 #error This file is only meant to be compiled for ChromeOS | 20 #error This file is only meant to be compiled for ChromeOS |
21 #endif | 21 #endif |
22 | 22 |
(...skipping 14 matching lines...) Expand all Loading... |
37 WidgetGtk::Init(NULL, gfx::Rect(size)); | 37 WidgetGtk::Init(NULL, gfx::Rect(size)); |
38 | 38 |
39 SetContentsView(snapshot_view_); | 39 SetContentsView(snapshot_view_); |
40 | 40 |
41 UpdateIndex(browser, index); | 41 UpdateIndex(browser, index); |
42 } | 42 } |
43 | 43 |
44 | 44 |
45 void WmOverviewSnapshot::UpdateIndex(Browser* browser, int index) { | 45 void WmOverviewSnapshot::UpdateIndex(Browser* browser, int index) { |
46 vector<int> params; | 46 vector<int> params; |
47 params.push_back(x11_util::GetX11WindowFromGtkWidget( | 47 params.push_back(ui::GetX11WindowFromGtkWidget( |
48 GTK_WIDGET(browser->window()->GetNativeHandle()))); | 48 GTK_WIDGET(browser->window()->GetNativeHandle()))); |
49 params.push_back(index); | 49 params.push_back(index); |
50 WmIpc::instance()->SetWindowType( | 50 WmIpc::instance()->SetWindowType( |
51 GetNativeView(), | 51 GetNativeView(), |
52 WM_IPC_WINDOW_CHROME_TAB_SNAPSHOT, | 52 WM_IPC_WINDOW_CHROME_TAB_SNAPSHOT, |
53 ¶ms); | 53 ¶ms); |
54 index_ = index; | 54 index_ = index; |
55 } | 55 } |
56 | 56 |
57 void WmOverviewSnapshot::SetImage(const SkBitmap& image) { | 57 void WmOverviewSnapshot::SetImage(const SkBitmap& image) { |
58 CHECK(snapshot_view_) << "Init not called before setting image."; | 58 CHECK(snapshot_view_) << "Init not called before setting image."; |
59 snapshot_view_->SetImage(image); | 59 snapshot_view_->SetImage(image); |
60 | 60 |
61 // Reset the bounds to the size of the image. | 61 // Reset the bounds to the size of the image. |
62 gfx::Rect bounds; | 62 gfx::Rect bounds; |
63 GetBounds(&bounds, false); | 63 GetBounds(&bounds, false); |
64 bounds.set_width(image.width()); | 64 bounds.set_width(image.width()); |
65 bounds.set_height(image.height()); | 65 bounds.set_height(image.height()); |
66 SetBounds(bounds); | 66 SetBounds(bounds); |
67 | 67 |
68 configured_snapshot_ = true; | 68 configured_snapshot_ = true; |
69 } | 69 } |
70 | 70 |
71 } // namespace chromeos | 71 } // namespace chromeos |
OLD | NEW |