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 = 50; |
| 138 const int kMinContentsHeight = 50; |
| 139 |
134 // How long do we wait before we consider a window hung (in ms). | 140 // How long do we wait before we consider a window hung (in ms). |
135 static const int kDefaultPluginMessageResponseTimeout = 30000; | 141 static const int kDefaultPluginMessageResponseTimeout = 30000; |
136 // The number of milliseconds between loading animation frames. | 142 // The number of milliseconds between loading animation frames. |
137 static const int kLoadingAnimationFrameTimeMs = 30; | 143 static const int kLoadingAnimationFrameTimeMs = 30; |
138 // The amount of space we expect the window border to take up. | 144 // The amount of space we expect the window border to take up. |
139 static const int kWindowBorderWidth = 5; | 145 static const int kWindowBorderWidth = 5; |
140 | 146 |
141 // How round the 'new tab' style bookmarks bar is. | 147 // How round the 'new tab' style bookmarks bar is. |
142 static const int kNewtabBarRoundness = 5; | 148 static const int kNewtabBarRoundness = 5; |
143 // ------------ | 149 // ------------ |
(...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 | 2147 // Install devtools focus tracker when dev tools window is shown for the |
2142 // first time. | 2148 // first time. |
2143 devtools_focus_tracker_.reset( | 2149 devtools_focus_tracker_.reset( |
2144 new views::ExternalFocusTracker(devtools_container_, | 2150 new views::ExternalFocusTracker(devtools_container_, |
2145 GetFocusManager())); | 2151 GetFocusManager())); |
2146 } | 2152 } |
2147 | 2153 |
2148 // Restore split offset. | 2154 // Restore split offset. |
2149 int split_offset = browser_->profile()->GetPrefs()-> | 2155 int split_offset = browser_->profile()->GetPrefs()-> |
2150 GetInteger(prefs::kDevToolsSplitLocation); | 2156 GetInteger(prefs::kDevToolsSplitLocation); |
2151 if (split_offset == -1) { | 2157 if (split_offset == -1) |
2152 // Initial load, set to default value. | 2158 split_offset = contents_split_->height() * 2 / 3; |
2153 split_offset = 2 * contents_split_->height() / 3; | 2159 |
2154 } | |
2155 // Make sure user can see both panes. | 2160 // Make sure user can see both panes. |
2156 int min_split_size = contents_split_->height() / 10; | 2161 split_offset = std::min(contents_split_->height() - kMinDevToolsHeight, |
2157 split_offset = std::min(contents_split_->height() - min_split_size, | 2162 split_offset); |
2158 std::max(min_split_size, split_offset)); | 2163 split_offset = std::max(kMinContentsHeight, split_offset); |
| 2164 if (split_offset < 0) |
| 2165 split_offset = contents_split_->height() * 2 / 3; |
2159 contents_split_->set_divider_offset(split_offset); | 2166 contents_split_->set_divider_offset(split_offset); |
2160 | 2167 |
2161 devtools_container_->SetVisible(true); | 2168 devtools_container_->SetVisible(true); |
2162 contents_split_->InvalidateLayout(); | 2169 contents_split_->InvalidateLayout(); |
2163 Layout(); | 2170 Layout(); |
2164 } else if (should_hide) { | 2171 } else if (should_hide) { |
2165 // Store split offset when hiding devtools window only. | 2172 // Store split offset when hiding devtools window only. |
2166 browser_->profile()->GetPrefs()->SetInteger(prefs::kDevToolsSplitLocation, | 2173 browser_->profile()->GetPrefs()->SetInteger(prefs::kDevToolsSplitLocation, |
2167 contents_split_->divider_offset()); | 2174 contents_split_->divider_offset()); |
2168 | 2175 |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2604 view->GetWindow()->non_client_view()->SetAccessibleName( | 2611 view->GetWindow()->non_client_view()->SetAccessibleName( |
2605 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 2612 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
2606 return view; | 2613 return view; |
2607 } | 2614 } |
2608 #endif | 2615 #endif |
2609 | 2616 |
2610 // static | 2617 // static |
2611 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 2618 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
2612 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 2619 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
2613 } | 2620 } |
OLD | NEW |