OLD | NEW |
---|---|
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/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
6 | 6 |
7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 using views::ColumnSet; | 124 using views::ColumnSet; |
125 using views::GridLayout; | 125 using views::GridLayout; |
126 | 126 |
127 // The height of the status bubble. | 127 // The height of the status bubble. |
128 static const int kStatusBubbleHeight = 20; | 128 static const int kStatusBubbleHeight = 20; |
129 // The name of a key to store on the window handle so that other code can | 129 // The name of a key to store on the window handle so that other code can |
130 // locate this object using just the handle. | 130 // locate this object using just the handle. |
131 static const char* const kBrowserViewKey = "__BROWSER_VIEW__"; | 131 static const char* const kBrowserViewKey = "__BROWSER_VIEW__"; |
132 // How frequently we check for hung plugin windows. | 132 // How frequently we check for hung plugin windows. |
133 static const int kDefaultHungPluginDetectFrequency = 2000; | 133 static const int kDefaultHungPluginDetectFrequency = 2000; |
134 | |
135 // Minimal height of devtools pane or content pane when devtools are docked | |
136 // to the browser window. | |
137 const int kMinDevToolsHeight = 100; | |
138 | |
134 // How long do we wait before we consider a window hung (in ms). | 139 // How long do we wait before we consider a window hung (in ms). |
135 static const int kDefaultPluginMessageResponseTimeout = 30000; | 140 static const int kDefaultPluginMessageResponseTimeout = 30000; |
136 // The number of milliseconds between loading animation frames. | 141 // The number of milliseconds between loading animation frames. |
137 static const int kLoadingAnimationFrameTimeMs = 30; | 142 static const int kLoadingAnimationFrameTimeMs = 30; |
138 // The amount of space we expect the window border to take up. | 143 // The amount of space we expect the window border to take up. |
139 static const int kWindowBorderWidth = 5; | 144 static const int kWindowBorderWidth = 5; |
140 | 145 |
141 // How round the 'new tab' style bookmarks bar is. | 146 // How round the 'new tab' style bookmarks bar is. |
142 static const int kNewtabBarRoundness = 5; | 147 static const int kNewtabBarRoundness = 5; |
143 // ------------ | 148 // ------------ |
(...skipping 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2141 // Install devtools focus tracker when dev tools window is shown for the | 2146 // Install devtools focus tracker when dev tools window is shown for the |
2142 // first time. | 2147 // first time. |
2143 devtools_focus_tracker_.reset( | 2148 devtools_focus_tracker_.reset( |
2144 new views::ExternalFocusTracker(devtools_container_, | 2149 new views::ExternalFocusTracker(devtools_container_, |
2145 GetFocusManager())); | 2150 GetFocusManager())); |
2146 } | 2151 } |
2147 | 2152 |
2148 // Restore split offset. | 2153 // Restore split offset. |
2149 int split_offset = browser_->profile()->GetPrefs()-> | 2154 int split_offset = browser_->profile()->GetPrefs()-> |
2150 GetInteger(prefs::kDevToolsSplitLocation); | 2155 GetInteger(prefs::kDevToolsSplitLocation); |
2151 if (split_offset == -1) { | |
2152 // Initial load, set to default value. | |
2153 split_offset = 2 * contents_split_->height() / 3; | |
2154 } | |
2155 // Make sure user can see both panes. | 2156 // Make sure user can see both panes. |
2156 int min_split_size = contents_split_->height() / 10; | 2157 split_offset = std::min(contents_split_->height() - kMinDevToolsHeight, |
2157 split_offset = std::min(contents_split_->height() - min_split_size, | 2158 std::max(kMinDevToolsHeight, split_offset)); |
pfeldman
2011/06/07 20:14:51
While I agree that 50 is a good threshold for the
| |
2158 std::max(min_split_size, split_offset)); | |
2159 contents_split_->set_divider_offset(split_offset); | 2159 contents_split_->set_divider_offset(split_offset); |
2160 | 2160 |
2161 devtools_container_->SetVisible(true); | 2161 devtools_container_->SetVisible(true); |
2162 contents_split_->InvalidateLayout(); | 2162 contents_split_->InvalidateLayout(); |
2163 Layout(); | 2163 Layout(); |
2164 } else if (should_hide) { | 2164 } else if (should_hide) { |
2165 // Store split offset when hiding devtools window only. | 2165 // Store split offset when hiding devtools window only. |
2166 browser_->profile()->GetPrefs()->SetInteger(prefs::kDevToolsSplitLocation, | 2166 browser_->profile()->GetPrefs()->SetInteger(prefs::kDevToolsSplitLocation, |
2167 contents_split_->divider_offset()); | 2167 contents_split_->divider_offset()); |
2168 | 2168 |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2604 view->GetWindow()->non_client_view()->SetAccessibleName( | 2604 view->GetWindow()->non_client_view()->SetAccessibleName( |
2605 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 2605 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
2606 return view; | 2606 return view; |
2607 } | 2607 } |
2608 #endif | 2608 #endif |
2609 | 2609 |
2610 // static | 2610 // static |
2611 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 2611 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
2612 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 2612 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
2613 } | 2613 } |
OLD | NEW |