Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Side by Side Diff: chrome/browser/ui/views/panels/panel_view.cc

Issue 1708343002: Add ScopedKeepAlive to c/b/lifetime (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments on PS15 Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/panels/panel_view.h" 5 #include "chrome/browser/ui/views/panels/panel_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <map> 8 #include <map>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "chrome/app/chrome_command_ids.h" 16 #include "chrome/app/chrome_command_ids.h"
17 #include "chrome/browser/lifetime/keep_alive_types.h"
18 #include "chrome/browser/lifetime/scoped_keep_alive.h"
17 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/host_desktop.h" 20 #include "chrome/browser/ui/host_desktop.h"
19 #include "chrome/browser/ui/panels/panel.h" 21 #include "chrome/browser/ui/panels/panel.h"
20 #include "chrome/browser/ui/panels/panel_bounds_animation.h" 22 #include "chrome/browser/ui/panels/panel_bounds_animation.h"
21 #include "chrome/browser/ui/panels/panel_manager.h" 23 #include "chrome/browser/ui/panels/panel_manager.h"
22 #include "chrome/browser/ui/panels/stacked_panel_collection.h" 24 #include "chrome/browser/ui/panels/stacked_panel_collection.h"
23 #include "chrome/browser/ui/views/auto_keep_alive.h"
24 #include "chrome/browser/ui/views/panels/panel_frame_view.h" 25 #include "chrome/browser/ui/views/panels/panel_frame_view.h"
25 #include "content/public/browser/render_view_host.h" 26 #include "content/public/browser/render_view_host.h"
26 #include "content/public/browser/render_widget_host_view.h" 27 #include "content/public/browser/render_widget_host_view.h"
27 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
28 #include "ui/content_accelerators/accelerator_util.h" 29 #include "ui/content_accelerators/accelerator_util.h"
29 #include "ui/gfx/image/image.h" 30 #include "ui/gfx/image/image.h"
30 #include "ui/gfx/path.h" 31 #include "ui/gfx/path.h"
31 #include "ui/gfx/screen.h" 32 #include "ui/gfx/screen.h"
32 #include "ui/views/controls/button/image_button.h" 33 #include "ui/views/controls/button/image_button.h"
33 #include "ui/views/controls/webview/webview.h" 34 #include "ui/views/controls/webview/webview.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 #if defined(USE_X11) && !defined(OS_CHROMEOS) 294 #if defined(USE_X11) && !defined(OS_CHROMEOS)
294 params.wm_class_name = web_app::GetWMClassFromAppName(panel->app_name()); 295 params.wm_class_name = web_app::GetWMClassFromAppName(panel->app_name());
295 params.wm_class_class = shell_integration_linux::GetProgramClassName(); 296 params.wm_class_class = shell_integration_linux::GetProgramClassName();
296 #endif 297 #endif
297 298
298 window_->Init(params); 299 window_->Init(params);
299 window_->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM); 300 window_->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM);
300 window_->set_focus_on_creation(false); 301 window_->set_focus_on_creation(false);
301 window_->AddObserver(this); 302 window_->AddObserver(this);
302 303
304 #if !defined(OS_CHROMEOS)
sky 2016/02/25 18:43:50 I think want !USE_ASH here.
dgn 2016/02/25 20:08:50 Isn't there[1] where the count is incremented to b
sky 2016/02/25 23:27:49 I think that increment should be outside the ifdef
dgn 2016/02/26 11:51:59 Done.
dgn 2016/02/26 11:51:59 Thanks, I'll keep that in mind when changing that
303 // Prevent the browser process from shutting down while this window is open. 305 // Prevent the browser process from shutting down while this window is open.
304 keep_alive_.reset(new AutoKeepAlive(GetNativePanelWindow())); 306 // Chrome OS already has a mechanism to always stay alive and skips this.
307 keep_alive_.reset(new ScopedKeepAlive(KeepAliveOrigin::PANEL_VIEW));
308 #endif // !defined(OS_CHROMEOS)
305 309
306 web_view_ = new views::WebView(NULL); 310 web_view_ = new views::WebView(NULL);
307 AddChildView(web_view_); 311 AddChildView(web_view_);
308 312
309 // Register accelarators supported by panels. 313 // Register accelarators supported by panels.
310 views::FocusManager* focus_manager = GetFocusManager(); 314 views::FocusManager* focus_manager = GetFocusManager();
311 const std::map<ui::Accelerator, int>& accelerator_table = 315 const std::map<ui::Accelerator, int>& accelerator_table =
312 GetAcceleratorTable(); 316 GetAcceleratorTable();
313 for (std::map<ui::Accelerator, int>::const_iterator iter = 317 for (std::map<ui::Accelerator, int>::const_iterator iter =
314 accelerator_table.begin(); 318 accelerator_table.begin();
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 // SWP_FRAMECHANGED flag must be called in order for the cached window data 1147 // SWP_FRAMECHANGED flag must be called in order for the cached window data
1144 // to be updated properly. 1148 // to be updated properly.
1145 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms633591(v=vs.85).a spx 1149 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms633591(v=vs.85).a spx
1146 if (update_frame) { 1150 if (update_frame) {
1147 ::SetWindowPos(native_window, NULL, 0, 0, 0, 0, 1151 ::SetWindowPos(native_window, NULL, 0, 0, 0, 0,
1148 SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | 1152 SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE |
1149 SWP_NOZORDER | SWP_NOACTIVATE); 1153 SWP_NOZORDER | SWP_NOACTIVATE);
1150 } 1154 }
1151 } 1155 }
1152 #endif 1156 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698