Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(679)

Side by Side Diff: chrome/renderer/render_view.cc

Issue 56026: Move message flags into a separate header that can be used (Closed)
Patch Set: ctor Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/common/message_box_flags.h ('k') | chrome/views/controls/message_box_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/renderer/render_view.h" 5 #include "chrome/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/gfx/png_encoder.h" 12 #include "base/gfx/png_encoder.h"
13 #include "base/gfx/native_widget_types.h" 13 #include "base/gfx/native_widget_types.h"
14 #include "base/string_piece.h" 14 #include "base/string_piece.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "chrome/common/bindings_policy.h" 17 #include "chrome/common/bindings_policy.h"
18 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/gfx/favicon_size.h" 19 #include "chrome/common/gfx/favicon_size.h"
20 #include "chrome/common/gfx/color_utils.h" 20 #include "chrome/common/gfx/color_utils.h"
21 #include "chrome/common/jstemplate_builder.h" 21 #include "chrome/common/jstemplate_builder.h"
22 #include "chrome/common/l10n_util.h" 22 #include "chrome/common/l10n_util.h"
23 #include "chrome/common/message_box_flags.h"
23 #include "chrome/common/page_zoom.h" 24 #include "chrome/common/page_zoom.h"
24 #include "chrome/common/render_messages.h" 25 #include "chrome/common/render_messages.h"
25 #include "chrome/common/resource_bundle.h" 26 #include "chrome/common/resource_bundle.h"
26 #include "chrome/common/thumbnail_score.h" 27 #include "chrome/common/thumbnail_score.h"
27 #include "chrome/common/url_constants.h" 28 #include "chrome/common/url_constants.h"
28 #include "chrome/renderer/about_handler.h" 29 #include "chrome/renderer/about_handler.h"
29 #include "chrome/renderer/debug_message_handler.h" 30 #include "chrome/renderer/debug_message_handler.h"
30 #include "chrome/renderer/devtools_agent.h" 31 #include "chrome/renderer/devtools_agent.h"
31 #include "chrome/renderer/devtools_client.h" 32 #include "chrome/renderer/devtools_client.h"
32 #include "chrome/renderer/extensions/extension_process_bindings.h" 33 #include "chrome/renderer/extensions/extension_process_bindings.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 #if defined(OS_WIN) 71 #if defined(OS_WIN)
71 // TODO(port): these files are currently Windows only because they concern: 72 // TODO(port): these files are currently Windows only because they concern:
72 // * logging 73 // * logging
73 // * printing 74 // * printing
74 // * theming 75 // * theming
75 // * views 76 // * views
76 #include "base/gfx/gdi_util.h" 77 #include "base/gfx/gdi_util.h"
77 #include "base/gfx/native_theme.h" 78 #include "base/gfx/native_theme.h"
78 #include "chrome/common/gfx/emf.h" 79 #include "chrome/common/gfx/emf.h"
79 #include "chrome/renderer/renderer_logging.h" 80 #include "chrome/renderer/renderer_logging.h"
80 #include "chrome/views/controls/message_box_view.h"
81 #include "skia/ext/vector_canvas.h" 81 #include "skia/ext/vector_canvas.h"
82 #endif 82 #endif
83 83
84 #if defined(OS_WIN) 84 #if defined(OS_WIN)
85 // If true, the URL of the active renderer is logged. Logging is done in such 85 // If true, the URL of the active renderer is logged. Logging is done in such
86 // way that if the renderer crashes the URL of the active renderer is contained 86 // way that if the renderer crashes the URL of the active renderer is contained
87 // in the dump. Currently mini-dumps are only supported on windows, so this is 87 // in the dump. Currently mini-dumps are only supported on windows, so this is
88 // only enabled on windows. 88 // only enabled on windows.
89 #define LOG_RENDERER_URL 89 #define LOG_RENDERER_URL
90 #endif 90 #endif
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 type == WebNavigationTypeOther; 1588 type == WebNavigationTypeOther;
1589 if (is_fork) { 1589 if (is_fork) {
1590 // Open the URL via the browser, not via WebKit. 1590 // Open the URL via the browser, not via WebKit.
1591 OpenURL(webview, url, GURL(), disposition); 1591 OpenURL(webview, url, GURL(), disposition);
1592 return IGNORE_ACTION; 1592 return IGNORE_ACTION;
1593 } 1593 }
1594 1594
1595 return disposition; 1595 return disposition;
1596 } 1596 }
1597 1597
1598 #if defined(OS_POSIX)
1599 // TODO(port): remove this massive hack
1600 // WARNING: massive hack. We can't include message_box_view.h because that
1601 // tries to pull in the rest of views. So we just define a fake MessageBoxView
1602 // here with the constants that we require.
1603
1604 class MessageBoxView {
1605 public:
1606 static const int kFlagHasOKButton = 0x1;
1607 static const int kFlagHasCancelButton = 0x2;
1608 static const int kFlagHasPromptField = 0x4;
1609 static const int kFlagHasMessage = 0x8;
1610
1611 static const int kIsConfirmMessageBox = kFlagHasMessage |
1612 kFlagHasOKButton |
1613 kFlagHasCancelButton;
1614 static const int kIsJavascriptAlert = kFlagHasOKButton | kFlagHasMessage;
1615 static const int kIsJavascriptConfirm = kIsJavascriptAlert |
1616 kFlagHasCancelButton;
1617 static const int kIsJavascriptPrompt = kIsJavascriptConfirm |
1618 kFlagHasPromptField;
1619 };
1620 #endif
1621
1622 void RenderView::RunJavaScriptAlert(WebFrame* webframe, 1598 void RenderView::RunJavaScriptAlert(WebFrame* webframe,
1623 const std::wstring& message) { 1599 const std::wstring& message) {
1624 RunJavaScriptMessage(MessageBoxView::kIsJavascriptAlert, 1600 RunJavaScriptMessage(MessageBox::kIsJavascriptAlert,
1625 message, 1601 message,
1626 std::wstring(), 1602 std::wstring(),
1627 webframe->GetURL(), 1603 webframe->GetURL(),
1628 NULL); 1604 NULL);
1629 } 1605 }
1630 1606
1631 bool RenderView::RunJavaScriptConfirm(WebFrame* webframe, 1607 bool RenderView::RunJavaScriptConfirm(WebFrame* webframe,
1632 const std::wstring& message) { 1608 const std::wstring& message) {
1633 return RunJavaScriptMessage(MessageBoxView::kIsJavascriptConfirm, 1609 return RunJavaScriptMessage(MessageBox::kIsJavascriptConfirm,
1634 message, 1610 message,
1635 std::wstring(), 1611 std::wstring(),
1636 webframe->GetURL(), 1612 webframe->GetURL(),
1637 NULL); 1613 NULL);
1638 } 1614 }
1639 1615
1640 bool RenderView::RunJavaScriptPrompt(WebFrame* webframe, 1616 bool RenderView::RunJavaScriptPrompt(WebFrame* webframe,
1641 const std::wstring& message, 1617 const std::wstring& message,
1642 const std::wstring& default_value, 1618 const std::wstring& default_value,
1643 std::wstring* result) { 1619 std::wstring* result) {
1644 return RunJavaScriptMessage(MessageBoxView::kIsJavascriptPrompt, 1620 return RunJavaScriptMessage(MessageBox::kIsJavascriptPrompt,
1645 message, 1621 message,
1646 default_value, 1622 default_value,
1647 webframe->GetURL(), 1623 webframe->GetURL(),
1648 result); 1624 result);
1649 } 1625 }
1650 1626
1651 bool RenderView::RunJavaScriptMessage(int type, 1627 bool RenderView::RunJavaScriptMessage(int type,
1652 const std::wstring& message, 1628 const std::wstring& message,
1653 const std::wstring& default_value, 1629 const std::wstring& default_value,
1654 const GURL& frame_url, 1630 const GURL& frame_url,
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after
2991 void RenderView::OnExtensionResponse(int callback_id, 2967 void RenderView::OnExtensionResponse(int callback_id,
2992 const std::string& response) { 2968 const std::string& response) {
2993 WebFrame* web_frame = pending_extension_callbacks_.Lookup(callback_id); 2969 WebFrame* web_frame = pending_extension_callbacks_.Lookup(callback_id);
2994 if (!web_frame) 2970 if (!web_frame)
2995 return; // The frame went away. 2971 return; // The frame went away.
2996 2972
2997 extensions_v8::ExtensionProcessBindings::ExecuteCallbackInFrame( 2973 extensions_v8::ExtensionProcessBindings::ExecuteCallbackInFrame(
2998 web_frame, callback_id, response); 2974 web_frame, callback_id, response);
2999 pending_extension_callbacks_.Remove(callback_id); 2975 pending_extension_callbacks_.Remove(callback_id);
3000 } 2976 }
OLDNEW
« no previous file with comments | « chrome/common/message_box_flags.h ('k') | chrome/views/controls/message_box_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698