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

Side by Side Diff: chrome/browser/ui/window_sizer/window_sizer.cc

Issue 2652043004: Remove persisted docked windows (Closed)
Patch Set: varkha's comments Created 3 years, 11 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/window_sizer/window_sizer.h" 5 #include "chrome/browser/ui/window_sizer/window_sizer.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_list.h" 16 #include "chrome/browser/ui/browser_list.h"
17 #include "chrome/browser/ui/browser_window.h" 17 #include "chrome/browser/ui/browser_window.h"
18 #include "chrome/browser/ui/browser_window_state.h" 18 #include "chrome/browser/ui/browser_window_state.h"
19 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "components/prefs/pref_service.h" 20 #include "components/prefs/pref_service.h"
21 #include "ui/base/ui_base_switches.h" 21 #include "ui/base/ui_base_switches.h"
22 #include "ui/display/display.h" 22 #include "ui/display/display.h"
23 #include "ui/display/screen.h" 23 #include "ui/display/screen.h"
24 24
25 #if defined(USE_ASH) 25 #if defined(USE_ASH)
26 #include "ash/common/ash_switches.h"
26 #include "ash/common/wm/window_positioner.h" // nogncheck 27 #include "ash/common/wm/window_positioner.h" // nogncheck
27 #include "ash/shell.h" // nogncheck 28 #include "ash/shell.h" // nogncheck
28 #include "chrome/browser/ui/ash/ash_util.h" // nogncheck 29 #include "chrome/browser/ui/ash/ash_util.h" // nogncheck
29 #endif 30 #endif
30 31
31 namespace { 32 namespace {
32 33
33 // Minimum height of the visible part of a window. 34 // Minimum height of the visible part of a window.
34 const int kMinVisibleHeight = 30; 35 const int kMinVisibleHeight = 30;
35 // Minimum width of the visible part of a window. 36 // Minimum width of the visible part of a window.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 int work_area_bottom = 0; 74 int work_area_bottom = 0;
74 int work_area_right = 0; 75 int work_area_right = 0;
75 if (wp_pref) { 76 if (wp_pref) {
76 wp_pref->GetInteger("work_area_top", &work_area_top); 77 wp_pref->GetInteger("work_area_top", &work_area_top);
77 wp_pref->GetInteger("work_area_left", &work_area_left); 78 wp_pref->GetInteger("work_area_left", &work_area_left);
78 wp_pref->GetInteger("work_area_bottom", &work_area_bottom); 79 wp_pref->GetInteger("work_area_bottom", &work_area_bottom);
79 wp_pref->GetInteger("work_area_right", &work_area_right); 80 wp_pref->GetInteger("work_area_right", &work_area_right);
80 if (*show_state == ui::SHOW_STATE_DEFAULT && maximized) 81 if (*show_state == ui::SHOW_STATE_DEFAULT && maximized)
81 *show_state = ui::SHOW_STATE_MAXIMIZED; 82 *show_state = ui::SHOW_STATE_MAXIMIZED;
82 #if defined(USE_ASH) 83 #if defined(USE_ASH)
83 bool docked = false; 84 // TODO(afakhry): Remove Docked Windows in M58.
84 wp_pref->GetBoolean("docked", &docked); 85 if (ash::switches::DockedWindowsEnabled()) {
85 if (*show_state == ui::SHOW_STATE_DEFAULT && docked && 86 bool docked = false;
86 !browser_->is_type_tabbed()) { 87 wp_pref->GetBoolean("docked", &docked);
87 *show_state = ui::SHOW_STATE_DOCKED; 88 if (*show_state == ui::SHOW_STATE_DEFAULT && docked &&
89 !browser_->is_type_tabbed()) {
90 *show_state = ui::SHOW_STATE_DOCKED;
91 }
88 } 92 }
89 #endif // USE_ASH 93 #endif // USE_ASH
90 } 94 }
91 work_area->SetRect(work_area_left, work_area_top, 95 work_area->SetRect(work_area_left, work_area_top,
92 std::max(0, work_area_right - work_area_left), 96 std::max(0, work_area_right - work_area_left),
93 std::max(0, work_area_bottom - work_area_top)); 97 std::max(0, work_area_bottom - work_area_top));
94 98
95 return has_prefs; 99 return has_prefs;
96 } 100 }
97 101
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 430 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
427 switches::kStartMaximized)) 431 switches::kStartMaximized))
428 return ui::SHOW_STATE_MAXIMIZED; 432 return ui::SHOW_STATE_MAXIMIZED;
429 433
430 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) 434 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT)
431 return browser_->initial_show_state(); 435 return browser_->initial_show_state();
432 436
433 // Otherwise we use the default which can be overridden later on. 437 // Otherwise we use the default which can be overridden later on.
434 return ui::SHOW_STATE_DEFAULT; 438 return ui::SHOW_STATE_DEFAULT;
435 } 439 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_frame_ash.cc ('k') | components/sessions/core/session_service_commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698