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 2084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2095 if (should_show) { | 2095 if (should_show) { |
2096 if (!devtools_focus_tracker_.get()) { | 2096 if (!devtools_focus_tracker_.get()) { |
2097 // Install devtools focus tracker when dev tools window is shown for the | 2097 // Install devtools focus tracker when dev tools window is shown for the |
2098 // first time. | 2098 // first time. |
2099 devtools_focus_tracker_.reset( | 2099 devtools_focus_tracker_.reset( |
2100 new views::ExternalFocusTracker(devtools_container_, | 2100 new views::ExternalFocusTracker(devtools_container_, |
2101 GetFocusManager())); | 2101 GetFocusManager())); |
2102 } | 2102 } |
2103 | 2103 |
2104 // Restore split offset. | 2104 // Restore split offset. |
2105 int split_offset = browser_->profile()->GetPrefs()-> | 2105 int split_offset = g_browser_process->local_state()->GetInteger( |
2106 GetInteger(prefs::kDevToolsSplitLocation); | 2106 prefs::kDevToolsSplitLocation); |
2107 if (split_offset == -1) { | 2107 if (split_offset == -1) { |
2108 // Initial load, set to default value. | 2108 // Initial load, set to default value. |
2109 split_offset = 2 * contents_split_->height() / 3; | 2109 split_offset = 2 * contents_split_->height() / 3; |
2110 } | 2110 } |
2111 // Make sure user can see both panes. | 2111 // Make sure user can see both panes. |
2112 int min_split_size = contents_split_->height() / 10; | 2112 int min_split_size = contents_split_->height() / 10; |
2113 split_offset = std::min(contents_split_->height() - min_split_size, | 2113 split_offset = std::min(contents_split_->height() - min_split_size, |
2114 std::max(min_split_size, split_offset)); | 2114 std::max(min_split_size, split_offset)); |
2115 contents_split_->set_divider_offset(split_offset); | 2115 contents_split_->set_divider_offset(split_offset); |
2116 | 2116 |
2117 devtools_container_->SetVisible(true); | 2117 devtools_container_->SetVisible(true); |
2118 contents_split_->InvalidateLayout(); | 2118 contents_split_->InvalidateLayout(); |
2119 Layout(); | 2119 Layout(); |
2120 } else if (should_hide) { | 2120 } else if (should_hide) { |
2121 // Store split offset when hiding devtools window only. | 2121 // Store split offset when hiding devtools window only. |
2122 browser_->profile()->GetPrefs()->SetInteger(prefs::kDevToolsSplitLocation, | 2122 g_browser_process->local_state()->SetInteger( |
2123 contents_split_->divider_offset()); | 2123 prefs::kDevToolsSplitLocation, contents_split_->divider_offset()); |
2124 | 2124 |
2125 // Restore focus to the last focused view when hiding devtools window. | 2125 // Restore focus to the last focused view when hiding devtools window. |
2126 devtools_focus_tracker_->FocusLastFocusedExternalView(); | 2126 devtools_focus_tracker_->FocusLastFocusedExternalView(); |
2127 | 2127 |
2128 devtools_container_->SetVisible(false); | 2128 devtools_container_->SetVisible(false); |
2129 contents_split_->InvalidateLayout(); | 2129 contents_split_->InvalidateLayout(); |
2130 Layout(); | 2130 Layout(); |
2131 } | 2131 } |
2132 } | 2132 } |
2133 | 2133 |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2553 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 2553 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
2554 | 2554 |
2555 return view; | 2555 return view; |
2556 } | 2556 } |
2557 #endif | 2557 #endif |
2558 | 2558 |
2559 // static | 2559 // static |
2560 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 2560 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
2561 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 2561 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
2562 } | 2562 } |
OLD | NEW |