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 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
24 #include "chrome/browser/debugger/devtools_window.h" | 24 #include "chrome/browser/debugger/devtools_window.h" |
25 #include "chrome/browser/dom_ui/bug_report_ui.h" | 25 #include "chrome/browser/dom_ui/bug_report_ui.h" |
26 #include "chrome/browser/download/download_manager.h" | 26 #include "chrome/browser/download/download_manager.h" |
27 #include "chrome/browser/instant/instant_controller.h" | 27 #include "chrome/browser/instant/instant_controller.h" |
28 #include "chrome/browser/metrics/user_metrics.h" | 28 #include "chrome/browser/metrics/user_metrics.h" |
29 #include "chrome/browser/ntp_background_util.h" | 29 #include "chrome/browser/ntp_background_util.h" |
30 #include "chrome/browser/page_info_window.h" | 30 #include "chrome/browser/page_info_window.h" |
31 #include "chrome/browser/prefs/pref_service.h" | 31 #include "chrome/browser/prefs/pref_service.h" |
32 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
| 33 #include "chrome/browser/profiles/profile_manager.h" |
33 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 34 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
34 #include "chrome/browser/sessions/tab_restore_service.h" | 35 #include "chrome/browser/sessions/tab_restore_service.h" |
35 #include "chrome/browser/sidebar/sidebar_container.h" | 36 #include "chrome/browser/sidebar/sidebar_container.h" |
36 #include "chrome/browser/sidebar/sidebar_manager.h" | 37 #include "chrome/browser/sidebar/sidebar_manager.h" |
37 #include "chrome/browser/tab_contents/tab_contents.h" | 38 #include "chrome/browser/tab_contents/tab_contents.h" |
38 #include "chrome/browser/tab_contents/tab_contents_view.h" | 39 #include "chrome/browser/tab_contents/tab_contents_view.h" |
39 #include "chrome/browser/tabs/tab_strip_model.h" | 40 #include "chrome/browser/tabs/tab_strip_model.h" |
40 #include "chrome/browser/themes/browser_theme_provider.h" | 41 #include "chrome/browser/themes/browser_theme_provider.h" |
41 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" | 42 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" |
42 #include "chrome/browser/ui/browser.h" | 43 #include "chrome/browser/ui/browser.h" |
(...skipping 2084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2127 if (should_show) { | 2128 if (should_show) { |
2128 if (!devtools_focus_tracker_.get()) { | 2129 if (!devtools_focus_tracker_.get()) { |
2129 // Install devtools focus tracker when dev tools window is shown for the | 2130 // Install devtools focus tracker when dev tools window is shown for the |
2130 // first time. | 2131 // first time. |
2131 devtools_focus_tracker_.reset( | 2132 devtools_focus_tracker_.reset( |
2132 new views::ExternalFocusTracker(devtools_container_, | 2133 new views::ExternalFocusTracker(devtools_container_, |
2133 GetFocusManager())); | 2134 GetFocusManager())); |
2134 } | 2135 } |
2135 | 2136 |
2136 // Restore split offset. | 2137 // Restore split offset. |
2137 int split_offset = g_browser_process->local_state()->GetInteger( | 2138 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
2138 prefs::kDevToolsSplitLocation); | 2139 int split_offset = profile_manager->GetDefaultProfile()->GetPrefs()-> |
| 2140 GetInteger(prefs::kDevToolsSplitLocation); |
2139 if (split_offset == -1) { | 2141 if (split_offset == -1) { |
2140 // Initial load, set to default value. | 2142 // Initial load, set to default value. |
2141 split_offset = 2 * contents_split_->height() / 3; | 2143 split_offset = 2 * contents_split_->height() / 3; |
2142 } | 2144 } |
2143 // Make sure user can see both panes. | 2145 // Make sure user can see both panes. |
2144 int min_split_size = contents_split_->height() / 10; | 2146 int min_split_size = contents_split_->height() / 10; |
2145 split_offset = std::min(contents_split_->height() - min_split_size, | 2147 split_offset = std::min(contents_split_->height() - min_split_size, |
2146 std::max(min_split_size, split_offset)); | 2148 std::max(min_split_size, split_offset)); |
2147 contents_split_->set_divider_offset(split_offset); | 2149 contents_split_->set_divider_offset(split_offset); |
2148 | 2150 |
2149 devtools_container_->SetVisible(true); | 2151 devtools_container_->SetVisible(true); |
2150 contents_split_->Layout(); | 2152 contents_split_->Layout(); |
2151 } else if (should_hide) { | 2153 } else if (should_hide) { |
2152 // Store split offset when hiding devtools window only. | 2154 // Store split offset when hiding devtools window only. |
2153 g_browser_process->local_state()->SetInteger( | 2155 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
2154 prefs::kDevToolsSplitLocation, contents_split_->divider_offset()); | 2156 profile_manager->GetDefaultProfile()->GetPrefs()-> |
| 2157 SetInteger(prefs::kDevToolsSplitLocation, |
| 2158 contents_split_->divider_offset()); |
2155 | 2159 |
2156 // Restore focus to the last focused view when hiding devtools window. | 2160 // Restore focus to the last focused view when hiding devtools window. |
2157 devtools_focus_tracker_->FocusLastFocusedExternalView(); | 2161 devtools_focus_tracker_->FocusLastFocusedExternalView(); |
2158 | 2162 |
2159 devtools_container_->SetVisible(false); | 2163 devtools_container_->SetVisible(false); |
2160 contents_split_->Layout(); | 2164 contents_split_->Layout(); |
2161 } | 2165 } |
2162 } | 2166 } |
2163 | 2167 |
2164 void BrowserView::UpdateUIForContents(TabContentsWrapper* contents) { | 2168 void BrowserView::UpdateUIForContents(TabContentsWrapper* contents) { |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2579 UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); | 2583 UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); |
2580 | 2584 |
2581 return view; | 2585 return view; |
2582 } | 2586 } |
2583 #endif | 2587 #endif |
2584 | 2588 |
2585 // static | 2589 // static |
2586 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 2590 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
2587 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 2591 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
2588 } | 2592 } |
OLD | NEW |