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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 } | 367 } |
366 | 368 |
367 void CreateReloadMessage() { | 369 void CreateReloadMessage() { |
368 CHECK(!reload_message_); | 370 CHECK(!reload_message_); |
369 reload_message_.reset(new views::Widget); | 371 reload_message_.reset(new views::Widget); |
370 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); | 372 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); |
371 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 373 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
372 params.parent = GetWidget()->GetNativeView(); | 374 params.parent = GetWidget()->GetNativeView(); |
373 reload_message_->Init(params); | 375 reload_message_->Init(params); |
374 | 376 |
375 views::Label* label = new views::Label(base::UTF8ToUTF16("Reload")); | 377 views::Label* label = new views::Label( |
| 378 l10n_util::GetStringUTF16(IDS_ATHENA_PULL_TO_RELOAD_MESSAGE)); |
376 label->SetBackgroundColor(SK_ColorGRAY); | 379 label->SetBackgroundColor(SK_ColorGRAY); |
377 label->set_background( | 380 label->set_background( |
378 views::Background::CreateSolidBackground(SK_ColorGRAY)); | 381 views::Background::CreateSolidBackground(SK_ColorGRAY)); |
379 | 382 |
380 reload_message_->SetContentsView(label); | 383 reload_message_->SetContentsView(label); |
381 reload_message_->SetBounds(ConvertRectToWidget( | 384 reload_message_->SetBounds(ConvertRectToWidget( |
382 gfx::Rect(0, 0, width(), label->GetPreferredSize().height()))); | 385 gfx::Rect(0, 0, width(), label->GetPreferredSize().height()))); |
383 } | 386 } |
384 | 387 |
385 scoped_ptr<WebActivityController> controller_; | 388 scoped_ptr<WebActivityController> controller_; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 | 640 |
638 void WebActivity::ReloadAndObserve() { | 641 void WebActivity::ReloadAndObserve() { |
639 if (web_view_->IsContentEvicted()) { | 642 if (web_view_->IsContentEvicted()) { |
640 DCHECK_EQ(ACTIVITY_UNLOADED, current_state_); | 643 DCHECK_EQ(ACTIVITY_UNLOADED, current_state_); |
641 web_view_->ReloadContent(); | 644 web_view_->ReloadContent(); |
642 } | 645 } |
643 Observe(web_view_->GetWebContents()); | 646 Observe(web_view_->GetWebContents()); |
644 } | 647 } |
645 | 648 |
646 } // namespace athena | 649 } // namespace athena |
OLD | NEW |