Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/download/download_danger_prompt.h" | 5 #include "chrome/browser/download/download_danger_prompt.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "chrome/browser/download/download_stats.h" | 8 #include "chrome/browser/download/download_stats.h" |
| 9 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s ampling.h" | 9 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s ampling.h" |
| 10 #include "chrome/grit/chromium_strings.h" | 10 #include "chrome/grit/chromium_strings.h" |
| 11 #include "chrome/grit/generated_resources.h" | 11 #include "chrome/grit/generated_resources.h" |
| 12 #include "components/constrained_window/constrained_window_views.h" | 12 #include "components/constrained_window/constrained_window_views.h" |
| 13 #include "components/strings/grit/components_strings.h" | 13 #include "components/strings/grit/components_strings.h" |
| 14 #include "content/public/browser/browser_context.h" | 14 #include "content/public/browser/browser_context.h" |
| 15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/browser/download_danger_type.h" | 16 #include "content/public/browser/download_danger_type.h" |
| 17 #include "content/public/browser/download_item.h" | 17 #include "content/public/browser/download_item.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 20 #include "ui/base/ui_features.h" | |
| 20 #include "ui/views/controls/button/label_button.h" | 21 #include "ui/views/controls/button/label_button.h" |
| 21 #include "ui/views/controls/label.h" | 22 #include "ui/views/controls/label.h" |
| 22 #include "ui/views/layout/grid_layout.h" | 23 #include "ui/views/layout/grid_layout.h" |
| 23 #include "ui/views/view.h" | 24 #include "ui/views/view.h" |
| 24 #include "ui/views/widget/widget.h" | 25 #include "ui/views/widget/widget.h" |
| 25 #include "ui/views/window/dialog_client_view.h" | 26 #include "ui/views/window/dialog_client_view.h" |
| 26 #include "ui/views/window/dialog_delegate.h" | 27 #include "ui/views/window/dialog_delegate.h" |
| 27 #include "url/gurl.h" | 28 #include "url/gurl.h" |
| 28 | 29 |
| 29 using extensions::ExperienceSamplingEvent; | 30 using extensions::ExperienceSamplingEvent; |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 318 } | 319 } |
| 319 download_->RemoveObserver(this); | 320 download_->RemoveObserver(this); |
| 320 download_ = NULL; | 321 download_ = NULL; |
| 321 } | 322 } |
| 322 if (!done.is_null()) | 323 if (!done.is_null()) |
| 323 done.Run(action); | 324 done.Run(action); |
| 324 } | 325 } |
| 325 | 326 |
| 326 } // namespace | 327 } // namespace |
| 327 | 328 |
| 329 #if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER) | |
|
karandeepb
2017/01/23 06:51:40
maybe we can have a
#define COCOA_BROWSER #define
| |
| 330 // static | |
| 328 DownloadDangerPrompt* DownloadDangerPrompt::Create( | 331 DownloadDangerPrompt* DownloadDangerPrompt::Create( |
| 329 content::DownloadItem* item, | 332 content::DownloadItem* item, |
| 330 content::WebContents* web_contents, | 333 content::WebContents* web_contents, |
| 331 bool show_context, | 334 bool show_context, |
| 332 const OnDone& done) { | 335 const OnDone& done) { |
| 336 return DownloadDangerPrompt::CreateDownloadDangerPromptViews( | |
| 337 item, web_contents, show_context, done); | |
| 338 } | |
| 339 #endif | |
| 340 | |
| 341 // static | |
| 342 DownloadDangerPrompt* DownloadDangerPrompt::CreateDownloadDangerPromptViews( | |
| 343 content::DownloadItem* item, | |
| 344 content::WebContents* web_contents, | |
| 345 bool show_context, | |
| 346 const OnDone& done) { | |
| 333 DownloadDangerPromptViews* download_danger_prompt = | 347 DownloadDangerPromptViews* download_danger_prompt = |
| 334 new DownloadDangerPromptViews(item, show_context, done); | 348 new DownloadDangerPromptViews(item, show_context, done); |
| 335 constrained_window::ShowWebModalDialogViews(download_danger_prompt, | 349 constrained_window::ShowWebModalDialogViews(download_danger_prompt, |
| 336 web_contents); | 350 web_contents); |
| 337 return download_danger_prompt; | 351 return download_danger_prompt; |
| 338 } | 352 } |
| OLD | NEW |