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 "chrome/browser/chromeos/login/ui/simple_web_view_dialog.h" | 5 #include "chrome/browser/chromeos/login/ui/simple_web_view_dialog.h" |
6 | 6 |
7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
13 #include "chrome/browser/chromeos/login/helper.h" | 13 #include "chrome/browser/chromeos/login/helper.h" |
14 #include "chrome/browser/chromeos/login/ui/captive_portal_window_proxy.h" | 14 #include "chrome/browser/chromeos/login/ui/captive_portal_window_proxy.h" |
15 #include "chrome/browser/command_updater.h" | 15 #include "chrome/browser/command_updater.h" |
16 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 16 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/ssl/chrome_security_state_model_client.h" | 18 #include "chrome/browser/ssl/security_state_tab_helper.h" |
19 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" | 19 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" |
20 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
21 #include "chrome/browser/ui/content_settings/content_setting_bubble_model_delega
te.h" | 21 #include "chrome/browser/ui/content_settings/content_setting_bubble_model_delega
te.h" |
22 #include "chrome/browser/ui/view_ids.h" | 22 #include "chrome/browser/ui/view_ids.h" |
23 #include "chrome/browser/ui/views/toolbar/reload_button.h" | 23 #include "chrome/browser/ui/views/toolbar/reload_button.h" |
24 #include "chrome/grit/generated_resources.h" | 24 #include "chrome/grit/generated_resources.h" |
25 #include "chrome/grit/theme_resources.h" | 25 #include "chrome/grit/theme_resources.h" |
26 #include "components/password_manager/core/browser/password_manager.h" | 26 #include "components/password_manager/core/browser/password_manager.h" |
27 #include "components/security_state/security_state_model.h" | |
28 #include "components/strings/grit/components_strings.h" | 27 #include "components/strings/grit/components_strings.h" |
29 #include "components/toolbar/toolbar_model_impl.h" | 28 #include "components/toolbar/toolbar_model_impl.h" |
30 #include "content/public/browser/navigation_controller.h" | 29 #include "content/public/browser/navigation_controller.h" |
31 #include "content/public/browser/navigation_entry.h" | 30 #include "content/public/browser/navigation_entry.h" |
32 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
33 #include "content/public/common/content_constants.h" | 32 #include "content/public/common/content_constants.h" |
34 #include "ipc/ipc_message.h" | 33 #include "ipc/ipc_message.h" |
35 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
36 #include "ui/base/theme_provider.h" | 35 #include "ui/base/theme_provider.h" |
37 #include "ui/views/background.h" | 36 #include "ui/views/background.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 157 |
159 // Create the password manager that is needed for the proxy. | 158 // Create the password manager that is needed for the proxy. |
160 ChromePasswordManagerClient::CreateForWebContentsWithAutofillClient( | 159 ChromePasswordManagerClient::CreateForWebContentsWithAutofillClient( |
161 web_contents, | 160 web_contents, |
162 autofill::ChromeAutofillClient::FromWebContents(web_contents)); | 161 autofill::ChromeAutofillClient::FromWebContents(web_contents)); |
163 } | 162 } |
164 | 163 |
165 void SimpleWebViewDialog::Init() { | 164 void SimpleWebViewDialog::Init() { |
166 // Create the security state model that the toolbar model needs. | 165 // Create the security state model that the toolbar model needs. |
167 if (web_view_->GetWebContents()) | 166 if (web_view_->GetWebContents()) |
168 ChromeSecurityStateModelClient::CreateForWebContents( | 167 SecurityStateTabHelper::CreateForWebContents(web_view_->GetWebContents()); |
169 web_view_->GetWebContents()); | |
170 toolbar_model_.reset( | 168 toolbar_model_.reset( |
171 new ToolbarModelImpl(this, content::kMaxURLDisplayChars)); | 169 new ToolbarModelImpl(this, content::kMaxURLDisplayChars)); |
172 | 170 |
173 set_background(views::Background::CreateSolidBackground(kDialogColor)); | 171 set_background(views::Background::CreateSolidBackground(kDialogColor)); |
174 | 172 |
175 // Back/Forward buttons. | 173 // Back/Forward buttons. |
176 back_ = new views::ImageButton(this); | 174 back_ = new views::ImageButton(this); |
177 back_->set_triggerable_event_flags(ui::EF_LEFT_MOUSE_BUTTON | | 175 back_->set_triggerable_event_flags(ui::EF_LEFT_MOUSE_BUTTON | |
178 ui::EF_MIDDLE_MOUSE_BUTTON); | 176 ui::EF_MIDDLE_MOUSE_BUTTON); |
179 back_->set_tag(IDC_BACK); | 177 back_->set_tag(IDC_BACK); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 } | 291 } |
294 | 292 |
295 ContentSettingBubbleModelDelegate* | 293 ContentSettingBubbleModelDelegate* |
296 SimpleWebViewDialog::GetContentSettingBubbleModelDelegate() { | 294 SimpleWebViewDialog::GetContentSettingBubbleModelDelegate() { |
297 return bubble_model_delegate_.get(); | 295 return bubble_model_delegate_.get(); |
298 } | 296 } |
299 | 297 |
300 void SimpleWebViewDialog::ShowWebsiteSettings( | 298 void SimpleWebViewDialog::ShowWebsiteSettings( |
301 content::WebContents* web_contents, | 299 content::WebContents* web_contents, |
302 const GURL& virtual_url, | 300 const GURL& virtual_url, |
303 const security_state::SecurityStateModel::SecurityInfo& security_info) { | 301 const security_state::SecurityInfo& security_info) { |
304 NOTIMPLEMENTED(); | 302 NOTIMPLEMENTED(); |
305 // TODO (markusheintz@): implement this | 303 // TODO (markusheintz@): implement this |
306 } | 304 } |
307 | 305 |
308 PageActionImageView* SimpleWebViewDialog::CreatePageActionImageView( | 306 PageActionImageView* SimpleWebViewDialog::CreatePageActionImageView( |
309 LocationBarView* owner, | 307 LocationBarView* owner, |
310 ExtensionAction* action) { | 308 ExtensionAction* action) { |
311 // Notreached because SimpleWebViewDialog uses a popup-mode LocationBarView, | 309 // Notreached because SimpleWebViewDialog uses a popup-mode LocationBarView, |
312 // and it doesn't create PageActionImageViews. | 310 // and it doesn't create PageActionImageViews. |
313 NOTREACHED(); | 311 NOTREACHED(); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 381 |
384 void SimpleWebViewDialog::UpdateReload(bool is_loading, bool force) { | 382 void SimpleWebViewDialog::UpdateReload(bool is_loading, bool force) { |
385 if (reload_) { | 383 if (reload_) { |
386 reload_->ChangeMode( | 384 reload_->ChangeMode( |
387 is_loading ? ReloadButton::MODE_STOP : ReloadButton::MODE_RELOAD, | 385 is_loading ? ReloadButton::MODE_STOP : ReloadButton::MODE_RELOAD, |
388 force); | 386 force); |
389 } | 387 } |
390 } | 388 } |
391 | 389 |
392 } // namespace chromeos | 390 } // namespace chromeos |
OLD | NEW |