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

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

Issue 8573026: Simplify how we obtain the maximized state without having to go through WindowSizer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 return gfx::Rect(0, 0, 800, 600); 901 return gfx::Rect(0, 0, 800, 600);
902 } 902 }
903 903
904 gfx::Rect restored_bounds = override_bounds_; 904 gfx::Rect restored_bounds = override_bounds_;
905 bool maximized; 905 bool maximized;
906 WindowSizer::GetBrowserWindowBounds(app_name_, restored_bounds, this, 906 WindowSizer::GetBrowserWindowBounds(app_name_, restored_bounds, this,
907 &restored_bounds, &maximized); 907 &restored_bounds, &maximized);
908 return restored_bounds; 908 return restored_bounds;
909 } 909 }
910 910
911 // TODO(beng): obtain maximized state some other way so we don't need to go
912 // through all this hassle.
913 ui::WindowShowState Browser::GetSavedWindowShowState() const { 911 ui::WindowShowState Browser::GetSavedWindowShowState() const {
914 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized)) 912 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized))
915 return ui::SHOW_STATE_MAXIMIZED; 913 return ui::SHOW_STATE_MAXIMIZED;
916 914
917 if (show_state_ != ui::SHOW_STATE_DEFAULT) 915 if (show_state_ != ui::SHOW_STATE_DEFAULT)
918 return show_state_; 916 return show_state_;
919 917
920 // An explicit maximized state was not set. Query the window sizer. 918 const DictionaryValue* window_pref =
921 gfx::Rect restored_bounds; 919 profile()->GetPrefs()->GetDictionary(GetWindowPlacementKey().c_str());
922 bool maximized = false; 920 bool maximized = false;
923 WindowSizer::GetBrowserWindowBounds(app_name_, restored_bounds, this, 921 window_pref->GetBoolean("maximized", &maximized);
924 &restored_bounds, &maximized); 922
925 return maximized ? ui::SHOW_STATE_MAXIMIZED : ui::SHOW_STATE_NORMAL; 923 return maximized ? ui::SHOW_STATE_MAXIMIZED : ui::SHOW_STATE_NORMAL;
926 } 924 }
927 925
928 SkBitmap Browser::GetCurrentPageIcon() const { 926 SkBitmap Browser::GetCurrentPageIcon() const {
929 TabContentsWrapper* contents = GetSelectedTabContentsWrapper(); 927 TabContentsWrapper* contents = GetSelectedTabContentsWrapper();
930 // |contents| can be NULL since GetCurrentPageIcon() is called by the window 928 // |contents| can be NULL since GetCurrentPageIcon() is called by the window
931 // during the window's creation (before tabs have been added). 929 // during the window's creation (before tabs have been added).
932 return contents ? contents->favicon_tab_helper()->GetFavicon() : SkBitmap(); 930 return contents ? contents->favicon_tab_helper()->GetFavicon() : SkBitmap();
933 } 931 }
934 932
(...skipping 4586 matching lines...) Expand 10 before | Expand all | Expand 10 after
5521 } 5519 }
5522 5520
5523 void Browser::UpdateFullscreenExitBubbleContent() { 5521 void Browser::UpdateFullscreenExitBubbleContent() {
5524 GURL url; 5522 GURL url;
5525 if (fullscreened_tab_) 5523 if (fullscreened_tab_)
5526 url = fullscreened_tab_->tab_contents()->GetURL(); 5524 url = fullscreened_tab_->tab_contents()->GetURL();
5527 5525
5528 window_->UpdateFullscreenExitBubbleContent( 5526 window_->UpdateFullscreenExitBubbleContent(
5529 url, GetFullscreenExitBubbleType()); 5527 url, GetFullscreenExitBubbleType());
5530 } 5528 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698