| 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/chromeos/login/eula_view.h" | 5 #include "chrome/browser/chromeos/login/eula_view.h" |
| 6 | 6 |
| 7 #include <signal.h> | 7 #include <signal.h> |
| 8 #include <sys/types.h> | 8 #include <sys/types.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "content/common/native_web_keyboard_event.h" | 34 #include "content/common/native_web_keyboard_event.h" |
| 35 #include "grit/chromium_strings.h" | 35 #include "grit/chromium_strings.h" |
| 36 #include "grit/generated_resources.h" | 36 #include "grit/generated_resources.h" |
| 37 #include "grit/locale_settings.h" | 37 #include "grit/locale_settings.h" |
| 38 #include "grit/theme_resources.h" | 38 #include "grit/theme_resources.h" |
| 39 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
| 40 #include "ui/base/resource/resource_bundle.h" | 40 #include "ui/base/resource/resource_bundle.h" |
| 41 #include "views/controls/button/checkbox.h" | 41 #include "views/controls/button/checkbox.h" |
| 42 #include "views/controls/label.h" | 42 #include "views/controls/label.h" |
| 43 #include "views/controls/throbber.h" | 43 #include "views/controls/throbber.h" |
| 44 #include "views/events/event.h" |
| 44 #include "views/layout/grid_layout.h" | 45 #include "views/layout/grid_layout.h" |
| 45 #include "views/layout/layout_constants.h" | 46 #include "views/layout/layout_constants.h" |
| 46 #include "views/layout/layout_manager.h" | 47 #include "views/layout/layout_manager.h" |
| 47 #include "views/widget/widget_gtk.h" | 48 #include "views/widget/widget_gtk.h" |
| 48 #include "views/window/dialog_delegate.h" | 49 #include "views/window/dialog_delegate.h" |
| 49 #include "views/window/window.h" | 50 #include "views/window/window.h" |
| 50 | 51 |
| 51 using views::WidgetGtk; | 52 using views::WidgetGtk; |
| 52 | 53 |
| 53 namespace { | 54 namespace { |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 if (changed_flags & TabContents::INVALIDATE_TITLE) { | 497 if (changed_flags & TabContents::INVALIDATE_TITLE) { |
| 497 if (PublishTitleIfReady(contents, google_eula_view_, google_eula_label_) || | 498 if (PublishTitleIfReady(contents, google_eula_view_, google_eula_label_) || |
| 498 PublishTitleIfReady(contents, oem_eula_view_, oem_eula_label_)) { | 499 PublishTitleIfReady(contents, oem_eula_view_, oem_eula_label_)) { |
| 499 Layout(); | 500 Layout(); |
| 500 } | 501 } |
| 501 } | 502 } |
| 502 } | 503 } |
| 503 | 504 |
| 504 void EulaView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 505 void EulaView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
| 505 views::Widget* widget = GetWidget(); | 506 views::Widget* widget = GetWidget(); |
| 506 if (widget && event.os_event && !event.skip_in_browser) | 507 if (widget && event.os_event && !event.skip_in_browser) { |
| 507 static_cast<views::WidgetGtk*>(widget)->HandleKeyboardEvent(event.os_event); | 508 views::KeyEvent views_event(reinterpret_cast<GdkEvent*>(event.os_event)); |
| 509 static_cast<views::WidgetGtk*>(widget)->HandleKeyboardEvent(views_event); |
| 510 } |
| 508 } | 511 } |
| 509 | 512 |
| 510 //////////////////////////////////////////////////////////////////////////////// | 513 //////////////////////////////////////////////////////////////////////////////// |
| 511 // EulaView, private: | 514 // EulaView, private: |
| 512 | 515 |
| 513 void EulaView::LoadEulaView(DOMView* eula_view, | 516 void EulaView::LoadEulaView(DOMView* eula_view, |
| 514 views::Label* eula_label, | 517 views::Label* eula_label, |
| 515 const GURL& eula_url) { | 518 const GURL& eula_url) { |
| 516 Profile* profile = ProfileManager::GetDefaultProfile(); | 519 Profile* profile = ProfileManager::GetDefaultProfile(); |
| 517 eula_view->Init(profile, | 520 eula_view->Init(profile, |
| 518 SiteInstance::CreateSiteInstanceForURL(profile, eula_url)); | 521 SiteInstance::CreateSiteInstanceForURL(profile, eula_url)); |
| 519 eula_view->LoadURL(eula_url); | 522 eula_view->LoadURL(eula_url); |
| 520 eula_view->tab_contents()->set_delegate(this); | 523 eula_view->tab_contents()->set_delegate(this); |
| 521 } | 524 } |
| 522 | 525 |
| 523 //////////////////////////////////////////////////////////////////////////////// | 526 //////////////////////////////////////////////////////////////////////////////// |
| 524 // EulaView, private, views::View implementation: | 527 // EulaView, private, views::View implementation: |
| 525 | 528 |
| 526 bool EulaView::OnKeyPressed(const views::KeyEvent&) { | 529 bool EulaView::OnKeyPressed(const views::KeyEvent&) { |
| 527 // Close message bubble if shown. bubble_ will be set to NULL in callback. | 530 // Close message bubble if shown. bubble_ will be set to NULL in callback. |
| 528 if (bubble_) { | 531 if (bubble_) { |
| 529 bubble_->Close(); | 532 bubble_->Close(); |
| 530 return true; | 533 return true; |
| 531 } | 534 } |
| 532 return false; | 535 return false; |
| 533 } | 536 } |
| 534 | 537 |
| 535 } // namespace chromeos | 538 } // namespace chromeos |
| OLD | NEW |