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(OS_LINUX) | 7 #if defined(OS_LINUX) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2106 if (should_show) { | 2106 if (should_show) { |
2107 if (!devtools_focus_tracker_.get()) { | 2107 if (!devtools_focus_tracker_.get()) { |
2108 // Install devtools focus tracker when dev tools window is shown for the | 2108 // Install devtools focus tracker when dev tools window is shown for the |
2109 // first time. | 2109 // first time. |
2110 devtools_focus_tracker_.reset( | 2110 devtools_focus_tracker_.reset( |
2111 new views::ExternalFocusTracker(devtools_container_, | 2111 new views::ExternalFocusTracker(devtools_container_, |
2112 GetFocusManager())); | 2112 GetFocusManager())); |
2113 } | 2113 } |
2114 | 2114 |
2115 // Restore split offset. | 2115 // Restore split offset. |
2116 int split_offset = g_browser_process->local_state()->GetInteger( | 2116 int split_offset = browser_->profile()->GetPrefs()-> |
2117 prefs::kDevToolsSplitLocation); | 2117 GetInteger(prefs::kDevToolsSplitLocation); |
2118 if (split_offset == -1) { | 2118 if (split_offset == -1) { |
2119 // Initial load, set to default value. | 2119 // Initial load, set to default value. |
2120 split_offset = 2 * contents_split_->height() / 3; | 2120 split_offset = 2 * contents_split_->height() / 3; |
2121 } | 2121 } |
2122 // Make sure user can see both panes. | 2122 // Make sure user can see both panes. |
2123 int min_split_size = contents_split_->height() / 10; | 2123 int min_split_size = contents_split_->height() / 10; |
2124 split_offset = std::min(contents_split_->height() - min_split_size, | 2124 split_offset = std::min(contents_split_->height() - min_split_size, |
2125 std::max(min_split_size, split_offset)); | 2125 std::max(min_split_size, split_offset)); |
2126 contents_split_->set_divider_offset(split_offset); | 2126 contents_split_->set_divider_offset(split_offset); |
2127 | 2127 |
2128 devtools_container_->SetVisible(true); | 2128 devtools_container_->SetVisible(true); |
2129 contents_split_->InvalidateLayout(); | 2129 contents_split_->InvalidateLayout(); |
2130 Layout(); | 2130 Layout(); |
2131 } else if (should_hide) { | 2131 } else if (should_hide) { |
2132 // Store split offset when hiding devtools window only. | 2132 // Store split offset when hiding devtools window only. |
2133 g_browser_process->local_state()->SetInteger( | 2133 browser_->profile()->GetPrefs()->SetInteger(prefs::kDevToolsSplitLocation, |
2134 prefs::kDevToolsSplitLocation, contents_split_->divider_offset()); | 2134 contents_split_->divider_offset()); |
2135 | 2135 |
2136 // Restore focus to the last focused view when hiding devtools window. | 2136 // Restore focus to the last focused view when hiding devtools window. |
2137 devtools_focus_tracker_->FocusLastFocusedExternalView(); | 2137 devtools_focus_tracker_->FocusLastFocusedExternalView(); |
2138 | 2138 |
2139 devtools_container_->SetVisible(false); | 2139 devtools_container_->SetVisible(false); |
2140 contents_split_->InvalidateLayout(); | 2140 contents_split_->InvalidateLayout(); |
2141 Layout(); | 2141 Layout(); |
2142 } | 2142 } |
2143 } | 2143 } |
2144 | 2144 |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2564 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 2564 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
2565 | 2565 |
2566 return view; | 2566 return view; |
2567 } | 2567 } |
2568 #endif | 2568 #endif |
2569 | 2569 |
2570 // static | 2570 // static |
2571 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 2571 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
2572 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 2572 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
2573 } | 2573 } |
OLD | NEW |