| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/views/simple_message_box_views.h" | 5 #include "chrome/browser/ui/views/simple_message_box_views.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/simple_message_box.h" | 9 #include "chrome/browser/simple_message_box.h" |
| 10 #include "chrome/browser/ui/views/window.h" | 10 #include "chrome/browser/ui/views/window.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 } // namespace browser | 35 } // namespace browser |
| 36 | 36 |
| 37 //////////////////////////////////////////////////////////////////////////////// | 37 //////////////////////////////////////////////////////////////////////////////// |
| 38 // SimpleMessageBoxViews, public: | 38 // SimpleMessageBoxViews, public: |
| 39 | 39 |
| 40 // static | 40 // static |
| 41 void SimpleMessageBoxViews::ShowErrorBox(gfx::NativeWindow parent_window, | 41 void SimpleMessageBoxViews::ShowErrorBox(gfx::NativeWindow parent_window, |
| 42 const string16& title, | 42 const string16& title, |
| 43 const string16& message) { | 43 const string16& message) { |
| 44 int dialog_flags = ui::MessageBoxFlags::kFlagHasMessage | | |
| 45 ui::MessageBoxFlags::kFlagHasOKButton; | |
| 46 | |
| 47 // This is a reference counted object so it is given an initial increment | 44 // This is a reference counted object so it is given an initial increment |
| 48 // in the constructor with a corresponding decrement in DeleteDelegate(). | 45 // in the constructor with a corresponding decrement in DeleteDelegate(). |
| 49 new SimpleMessageBoxViews(parent_window, dialog_flags, title, message); | 46 new SimpleMessageBoxViews(parent_window, |
| 47 ui::MessageBoxFlags::kIsJavascriptAlert, title, message); |
| 50 } | 48 } |
| 51 | 49 |
| 52 bool SimpleMessageBoxViews::ShowYesNoBox(gfx::NativeWindow parent_window, | 50 bool SimpleMessageBoxViews::ShowYesNoBox(gfx::NativeWindow parent_window, |
| 53 const string16& title, | 51 const string16& title, |
| 54 const string16& message) { | 52 const string16& message) { |
| 55 int dialog_flags = ui::MessageBoxFlags::kIsConfirmMessageBox; | 53 int dialog_flags = ui::MessageBoxFlags::kIsConfirmMessageBox; |
| 56 | 54 |
| 57 // This is a reference counted object so it is given an initial increment | 55 // This is a reference counted object so it is given an initial increment |
| 58 // in the constructor plus an extra one below to ensure the dialog persists | 56 // in the constructor plus an extra one below to ensure the dialog persists |
| 59 // until we retrieve the user response.. | 57 // until we retrieve the user response.. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 if (disposition_ == DISPOSITION_UNKNOWN) | 161 if (disposition_ == DISPOSITION_UNKNOWN) |
| 164 return base::MessagePumpDispatcher::EVENT_PROCESSED; | 162 return base::MessagePumpDispatcher::EVENT_PROCESSED; |
| 165 return base::MessagePumpDispatcher::EVENT_QUIT; | 163 return base::MessagePumpDispatcher::EVENT_QUIT; |
| 166 } | 164 } |
| 167 #else | 165 #else |
| 168 bool SimpleMessageBoxViews::Dispatch(GdkEvent* event) { | 166 bool SimpleMessageBoxViews::Dispatch(GdkEvent* event) { |
| 169 gtk_main_do_event(event); | 167 gtk_main_do_event(event); |
| 170 return disposition_ == DISPOSITION_UNKNOWN; | 168 return disposition_ == DISPOSITION_UNKNOWN; |
| 171 } | 169 } |
| 172 #endif | 170 #endif |
| OLD | NEW |