| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/frame/browser_view.h" | 5 #include "chrome/browser/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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "chrome/browser/window_sizer.h" | 55 #include "chrome/browser/window_sizer.h" |
| 56 #include "chrome/common/chrome_switches.h" | 56 #include "chrome/common/chrome_switches.h" |
| 57 #include "chrome/common/native_web_keyboard_event.h" | 57 #include "chrome/common/native_web_keyboard_event.h" |
| 58 #include "chrome/common/native_window_notification_source.h" | 58 #include "chrome/common/native_window_notification_source.h" |
| 59 #include "chrome/common/notification_service.h" | 59 #include "chrome/common/notification_service.h" |
| 60 #include "chrome/common/pref_names.h" | 60 #include "chrome/common/pref_names.h" |
| 61 #include "chrome/common/pref_service.h" | 61 #include "chrome/common/pref_service.h" |
| 62 #include "grit/app_resources.h" | 62 #include "grit/app_resources.h" |
| 63 #include "grit/chromium_strings.h" | 63 #include "grit/chromium_strings.h" |
| 64 #include "grit/generated_resources.h" | 64 #include "grit/generated_resources.h" |
| 65 #include "grit/locale_settings.h" |
| 65 #include "grit/theme_resources.h" | 66 #include "grit/theme_resources.h" |
| 66 #include "grit/webkit_resources.h" | 67 #include "grit/webkit_resources.h" |
| 67 #include "views/controls/single_split_view.h" | 68 #include "views/controls/single_split_view.h" |
| 68 #include "views/fill_layout.h" | 69 #include "views/fill_layout.h" |
| 69 #include "views/focus/external_focus_tracker.h" | 70 #include "views/focus/external_focus_tracker.h" |
| 70 #include "views/grid_layout.h" | 71 #include "views/grid_layout.h" |
| 71 #include "views/view.h" | 72 #include "views/view.h" |
| 72 #include "views/widget/root_view.h" | 73 #include "views/widget/root_view.h" |
| 73 #include "views/window/dialog_delegate.h" | 74 #include "views/window/dialog_delegate.h" |
| 74 #include "views/window/non_client_view.h" | 75 #include "views/window/non_client_view.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 warning_->set_border(views::Border::CreateEmptyBorder(10, 10, 10, 10)); | 320 warning_->set_border(views::Border::CreateEmptyBorder(10, 10, 10, 10)); |
| 320 layout->StartRow(0, columnset_id); | 321 layout->StartRow(0, columnset_id); |
| 321 layout->AddView(warning_); | 322 layout->AddView(warning_); |
| 322 | 323 |
| 323 explanation_ = new views::Label(explanation_text); | 324 explanation_ = new views::Label(explanation_text); |
| 324 explanation_->SetMultiLine(true); | 325 explanation_->SetMultiLine(true); |
| 325 explanation_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 326 explanation_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 326 explanation_->set_border(views::Border::CreateEmptyBorder(10, 10, 10, 10)); | 327 explanation_->set_border(views::Border::CreateEmptyBorder(10, 10, 10, 10)); |
| 327 layout->StartRow(0, columnset_id); | 328 layout->StartRow(0, columnset_id); |
| 328 layout->AddView(explanation_); | 329 layout->AddView(explanation_); |
| 330 |
| 331 dialog_dimensions_ = views::Window::GetLocalizedContentsSize( |
| 332 IDS_DOWNLOAD_IN_PROGRESS_WIDTH_CHARS, |
| 333 IDS_DOWNLOAD_IN_PROGRESS_MINIMUM_HEIGHT_LINES); |
| 334 const int height = |
| 335 warning_->GetHeightForWidth(dialog_dimensions_.width()) + |
| 336 explanation_->GetHeightForWidth(dialog_dimensions_.width()); |
| 337 dialog_dimensions_.set_height(std::max(height, |
| 338 dialog_dimensions_.height())); |
| 329 } | 339 } |
| 330 | 340 |
| 331 ~DownloadInProgressConfirmDialogDelegate() { | 341 ~DownloadInProgressConfirmDialogDelegate() { |
| 332 } | 342 } |
| 333 | 343 |
| 334 // View implementation: | 344 // View implementation: |
| 335 virtual gfx::Size GetPreferredSize() { | 345 virtual gfx::Size GetPreferredSize() { |
| 336 const int kContentWidth = 400; | 346 return dialog_dimensions_; |
| 337 const int height = warning_->GetHeightForWidth(kContentWidth) + | |
| 338 explanation_->GetHeightForWidth(kContentWidth); | |
| 339 return gfx::Size(kContentWidth, height); | |
| 340 } | 347 } |
| 341 | 348 |
| 342 // DialogDelegate implementation: | 349 // DialogDelegate implementation: |
| 343 virtual int GetDefaultDialogButton() const { | 350 virtual int GetDefaultDialogButton() const { |
| 344 return MessageBoxFlags::DIALOGBUTTON_CANCEL; | 351 return MessageBoxFlags::DIALOGBUTTON_CANCEL; |
| 345 } | 352 } |
| 346 | 353 |
| 347 virtual std::wstring GetDialogButtonLabel( | 354 virtual std::wstring GetDialogButtonLabel( |
| 348 MessageBoxFlags::DialogButton button) const { | 355 MessageBoxFlags::DialogButton button) const { |
| 349 if (button == MessageBoxFlags::DIALOGBUTTON_OK) | 356 if (button == MessageBoxFlags::DIALOGBUTTON_OK) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 377 private: | 384 private: |
| 378 Browser* browser_; | 385 Browser* browser_; |
| 379 views::Label* warning_; | 386 views::Label* warning_; |
| 380 views::Label* explanation_; | 387 views::Label* explanation_; |
| 381 | 388 |
| 382 std::wstring ok_button_text_; | 389 std::wstring ok_button_text_; |
| 383 std::wstring cancel_button_text_; | 390 std::wstring cancel_button_text_; |
| 384 | 391 |
| 385 std::wstring product_name_; | 392 std::wstring product_name_; |
| 386 | 393 |
| 394 gfx::Size dialog_dimensions_; |
| 395 |
| 387 DISALLOW_COPY_AND_ASSIGN(DownloadInProgressConfirmDialogDelegate); | 396 DISALLOW_COPY_AND_ASSIGN(DownloadInProgressConfirmDialogDelegate); |
| 388 }; | 397 }; |
| 389 | 398 |
| 390 /////////////////////////////////////////////////////////////////////////////// | 399 /////////////////////////////////////////////////////////////////////////////// |
| 391 // BrowserView, public: | 400 // BrowserView, public: |
| 392 | 401 |
| 393 // static | 402 // static |
| 394 void BrowserView::SetShowState(int state) { | 403 void BrowserView::SetShowState(int state) { |
| 395 explicit_show_state = state; | 404 explicit_show_state = state; |
| 396 } | 405 } |
| (...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2281 | 2290 |
| 2282 // static | 2291 // static |
| 2283 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 2292 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
| 2284 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 2293 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
| 2285 } | 2294 } |
| 2286 | 2295 |
| 2287 // static | 2296 // static |
| 2288 void BrowserList::AllBrowsersClosed() { | 2297 void BrowserList::AllBrowsersClosed() { |
| 2289 views::Window::CloseAllSecondaryWindows(); | 2298 views::Window::CloseAllSecondaryWindows(); |
| 2290 } | 2299 } |
| OLD | NEW |