| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/content/web_activity.h" | 5 #include "athena/content/web_activity.h" |
| 6 | 6 |
| 7 #include "athena/activity/public/activity_factory.h" | 7 #include "athena/activity/public/activity_factory.h" |
| 8 #include "athena/activity/public/activity_manager.h" | 8 #include "athena/activity/public/activity_manager.h" |
| 9 #include "athena/content/content_proxy.h" | 9 #include "athena/content/content_proxy.h" |
| 10 #include "athena/content/public/dialogs.h" | 10 #include "athena/content/public/dialogs.h" |
| 11 #include "athena/input/public/accelerator_manager.h" | 11 #include "athena/input/public/accelerator_manager.h" |
| 12 #include "athena/strings/grit/athena_strings.h" |
| 12 #include "base/bind.h" | 13 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 15 #include "components/favicon_base/select_favicon_frames.h" | 16 #include "components/favicon_base/select_favicon_frames.h" |
| 16 #include "content/public/browser/native_web_keyboard_event.h" | 17 #include "content/public/browser/native_web_keyboard_event.h" |
| 17 #include "content/public/browser/navigation_controller.h" | 18 #include "content/public/browser/navigation_controller.h" |
| 18 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 19 #include "content/public/browser/web_contents_delegate.h" | 20 #include "content/public/browser/web_contents_delegate.h" |
| 20 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
| 21 #include "content/public/common/favicon_url.h" | 22 #include "content/public/common/favicon_url.h" |
| 22 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
| 24 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/compositor/closure_animation_observer.h" | 25 #include "ui/compositor/closure_animation_observer.h" |
| 24 #include "ui/compositor/scoped_layer_animation_settings.h" | 26 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 25 #include "ui/views/background.h" | 27 #include "ui/views/background.h" |
| 26 #include "ui/views/controls/label.h" | 28 #include "ui/views/controls/label.h" |
| 27 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" | 29 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" |
| 28 #include "ui/views/controls/webview/webview.h" | 30 #include "ui/views/controls/webview/webview.h" |
| 29 #include "ui/views/focus/focus_manager.h" | 31 #include "ui/views/focus/focus_manager.h" |
| 30 #include "ui/views/widget/widget.h" | 32 #include "ui/views/widget/widget.h" |
| 31 | 33 |
| 32 namespace athena { | 34 namespace athena { |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 } | 366 } |
| 365 | 367 |
| 366 void CreateReloadMessage() { | 368 void CreateReloadMessage() { |
| 367 CHECK(!reload_message_); | 369 CHECK(!reload_message_); |
| 368 reload_message_.reset(new views::Widget); | 370 reload_message_.reset(new views::Widget); |
| 369 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); | 371 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); |
| 370 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 372 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 371 params.parent = GetWidget()->GetNativeView(); | 373 params.parent = GetWidget()->GetNativeView(); |
| 372 reload_message_->Init(params); | 374 reload_message_->Init(params); |
| 373 | 375 |
| 374 views::Label* label = new views::Label(base::UTF8ToUTF16("Reload")); | 376 views::Label* label = new views::Label( |
| 377 l10n_util::GetStringUTF16(IDS_ATHENA_PULL_TO_RELOAD_MESSAGE)); |
| 375 label->SetBackgroundColor(SK_ColorGRAY); | 378 label->SetBackgroundColor(SK_ColorGRAY); |
| 376 label->set_background( | 379 label->set_background( |
| 377 views::Background::CreateSolidBackground(SK_ColorGRAY)); | 380 views::Background::CreateSolidBackground(SK_ColorGRAY)); |
| 378 | 381 |
| 379 reload_message_->SetContentsView(label); | 382 reload_message_->SetContentsView(label); |
| 380 reload_message_->SetBounds(ConvertRectToWidget( | 383 reload_message_->SetBounds(ConvertRectToWidget( |
| 381 gfx::Rect(0, 0, width(), label->GetPreferredSize().height()))); | 384 gfx::Rect(0, 0, width(), label->GetPreferredSize().height()))); |
| 382 } | 385 } |
| 383 | 386 |
| 384 scoped_ptr<WebActivityController> controller_; | 387 scoped_ptr<WebActivityController> controller_; |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 | 635 |
| 633 void WebActivity::ReloadAndObserve() { | 636 void WebActivity::ReloadAndObserve() { |
| 634 if (web_view_->IsContentEvicted()) { | 637 if (web_view_->IsContentEvicted()) { |
| 635 DCHECK_EQ(ACTIVITY_UNLOADED, current_state_); | 638 DCHECK_EQ(ACTIVITY_UNLOADED, current_state_); |
| 636 web_view_->ReloadContent(); | 639 web_view_->ReloadContent(); |
| 637 } | 640 } |
| 638 Observe(web_view_->GetWebContents()); | 641 Observe(web_view_->GetWebContents()); |
| 639 } | 642 } |
| 640 | 643 |
| 641 } // namespace athena | 644 } // namespace athena |
| OLD | NEW |