| OLD | NEW | 
|   1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |   1 // Copyright (c) 2012 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/ui/sad_tab_helper.h" |   5 #include "chrome/browser/ui/sad_tab_helper.h" | 
|   6  |   6  | 
|   7 #include "base/logging.h" |   7 #include "base/logging.h" | 
|   8 #include "chrome/browser/browser_shutdown.h" |   8 #include "chrome/browser/browser_shutdown.h" | 
|   9 #include "chrome/browser/ui/sad_tab.h" |   9 #include "chrome/browser/ui/sad_tab.h" | 
|  10 #include "content/public/browser/web_contents.h" |  10 #include "content/public/browser/web_contents.h" | 
|  11  |  11  | 
|  12 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SadTabHelper); |  12 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SadTabHelper); | 
|  13  |  13  | 
|  14 namespace { |  14 namespace { | 
|  15  |  15  | 
|  16 chrome::SadTabKind SadTabKindFromTerminationStatus( |  16 chrome::SadTabKind SadTabKindFromTerminationStatus( | 
|  17     base::TerminationStatus status) { |  17     base::TerminationStatus status) { | 
|  18   switch (status) { |  18   switch (status) { | 
|  19 #if defined(OS_CHROMEOS) |  19 #if defined(OS_CHROMEOS) | 
|  20     case base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM: |  20     case base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM: | 
|  21       return chrome::SAD_TAB_KIND_KILLED_BY_OOM; |  21       return chrome::SAD_TAB_KIND_KILLED_BY_OOM; | 
|  22 #endif |  22 #endif | 
|  23     case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: |  23     case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: | 
 |  24     case base::TERMINATION_STATUS_LAUNCH_FAILED: | 
|  24       return chrome::SAD_TAB_KIND_KILLED; |  25       return chrome::SAD_TAB_KIND_KILLED; | 
|  25     default: |  26     default: | 
|  26       return chrome::SAD_TAB_KIND_CRASHED; |  27       return chrome::SAD_TAB_KIND_CRASHED; | 
|  27   } |  28   } | 
|  28 } |  29 } | 
|  29  |  30  | 
|  30 }  // namespace |  31 }  // namespace | 
|  31  |  32  | 
|  32 SadTabHelper::~SadTabHelper() { |  33 SadTabHelper::~SadTabHelper() { | 
|  33 } |  34 } | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
|  55  |  56  | 
|  56   if (chrome::SadTab::ShouldShow(status)) |  57   if (chrome::SadTab::ShouldShow(status)) | 
|  57     InstallSadTab(status); |  58     InstallSadTab(status); | 
|  58 } |  59 } | 
|  59  |  60  | 
|  60 void SadTabHelper::InstallSadTab(base::TerminationStatus status) { |  61 void SadTabHelper::InstallSadTab(base::TerminationStatus status) { | 
|  61   sad_tab_.reset(chrome::SadTab::Create( |  62   sad_tab_.reset(chrome::SadTab::Create( | 
|  62       web_contents(), SadTabKindFromTerminationStatus(status))); |  63       web_contents(), SadTabKindFromTerminationStatus(status))); | 
|  63   sad_tab_->Show(); |  64   sad_tab_->Show(); | 
|  64 } |  65 } | 
| OLD | NEW |