OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/main_menu.h" | 5 #include "chrome/browser/chromeos/main_menu.h" |
6 | 6 |
| 7 #include <string> |
7 #include <vector> | 8 #include <vector> |
8 | 9 |
9 #include "app/gfx/insets.h" | 10 #include "app/gfx/insets.h" |
10 #include "app/resource_bundle.h" | 11 #include "app/resource_bundle.h" |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
13 #include "base/string_util.h" | 14 #include "base/string_util.h" |
14 #include "chrome/browser/browser_list.h" | 15 #include "chrome/browser/browser_list.h" |
15 #include "chrome/browser/browser.h" | 16 #include "chrome/browser/browser.h" |
16 #include "chrome/browser/renderer_host/render_view_host.h" | 17 #include "chrome/browser/renderer_host/render_view_host.h" |
17 #include "chrome/browser/renderer_host/render_view_host_factory.h" | 18 #include "chrome/browser/renderer_host/render_view_host_factory.h" |
18 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 19 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
19 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" | 20 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" |
20 #include "chrome/browser/renderer_host/site_instance.h" | 21 #include "chrome/browser/renderer_host/site_instance.h" |
21 #include "chrome/browser/tab_contents/tab_contents.h" | 22 #include "chrome/browser/tab_contents/tab_contents.h" |
22 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" | 23 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" |
23 #include "grit/app_resources.h" | 24 #include "grit/app_resources.h" |
24 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
25 #include "grit/theme_resources.h" | 26 #include "grit/theme_resources.h" |
26 #include "third_party/skia/include/core/SkBitmap.h" | 27 #include "third_party/skia/include/core/SkBitmap.h" |
27 #include "views/background.h" | 28 #include "views/background.h" |
28 #include "views/painter.h" | 29 #include "views/painter.h" |
29 #include "views/screen.h" | 30 #include "views/screen.h" |
30 #include "views/widget/root_view.h" | 31 #include "views/widget/root_view.h" |
31 #include "views/widget/widget_gtk.h" | 32 #include "views/widget/widget_gtk.h" |
32 | 33 |
| 34 namespace chromeos { |
| 35 |
33 // Initial size of the renderer. This is contained within a window whose size | 36 // Initial size of the renderer. This is contained within a window whose size |
34 // is set to the size of the image IDR_MAIN_MENU_BUTTON_DROP_DOWN. | 37 // is set to the size of the image IDR_MAIN_MENU_BUTTON_DROP_DOWN. |
35 static const int kRendererX = 0; | 38 static const int kRendererX = 0; |
36 static const int kRendererY = 25; | 39 static const int kRendererY = 25; |
37 static const int kRendererWidth = 250; | 40 static const int kRendererWidth = 250; |
38 static const int kRendererHeight = 400; | 41 static const int kRendererHeight = 400; |
39 | 42 |
40 // Insets defining the regions that are stretched and titled to create the | 43 // Insets defining the regions that are stretched and titled to create the |
41 // background of the popup. These constants are fed into | 44 // background of the popup. These constants are fed into |
42 // Painter::CreateImagePainter as the insets, see it for details. | 45 // Painter::CreateImagePainter as the insets, see it for details. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 101 } |
99 | 102 |
100 // static | 103 // static |
101 void MainMenu::ScheduleCreation() { | 104 void MainMenu::ScheduleCreation() { |
102 MessageLoop::current()->PostDelayedTask(FROM_HERE, new LoadTask(), 5000); | 105 MessageLoop::current()->PostDelayedTask(FROM_HERE, new LoadTask(), 5000); |
103 } | 106 } |
104 | 107 |
105 MainMenu::~MainMenu() { | 108 MainMenu::~MainMenu() { |
106 // NOTE: we leak the menu_rvh_ and popup_ as by the time we get here the | 109 // NOTE: we leak the menu_rvh_ and popup_ as by the time we get here the |
107 // message loop and notification services have been shutdown. | 110 // message loop and notification services have been shutdown. |
108 // TODO(sky); fix this. | 111 // TODO(sky): fix this. |
109 // menu_rvh_->Shutdown(); | 112 // menu_rvh_->Shutdown(); |
110 // popup_->CloseNow(); | 113 // popup_->CloseNow(); |
111 } | 114 } |
112 | 115 |
113 MainMenu::MainMenu() | 116 MainMenu::MainMenu() |
114 : browser_(NULL), | 117 : browser_(NULL), |
115 popup_(NULL), | 118 popup_(NULL), |
116 site_instance_(NULL), | 119 site_instance_(NULL), |
117 menu_rvh_(NULL), | 120 menu_rvh_(NULL), |
118 rwhv_(NULL), | 121 rwhv_(NULL), |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 menu_->browser_->OpenURL(url, referrer, NEW_FOREGROUND_TAB, | 278 menu_->browser_->OpenURL(url, referrer, NEW_FOREGROUND_TAB, |
276 PageTransition::LINK); | 279 PageTransition::LINK); |
277 menu_->Hide(); | 280 menu_->Hide(); |
278 } | 281 } |
279 | 282 |
280 // LoadTask ------------------------------------------------------------------- | 283 // LoadTask ------------------------------------------------------------------- |
281 | 284 |
282 void MainMenu::LoadTask::Run() { | 285 void MainMenu::LoadTask::Run() { |
283 MainMenu::Get(); | 286 MainMenu::Get(); |
284 } | 287 } |
| 288 |
| 289 } // namespace chromeos |
OLD | NEW |